Question

I've got a list of LATLNG-coordinates and a table ready with a location-column called 'location'. I want to only show the results within the radius of 500 meter.

So this is the code with the latlng of one of the items in the list:

var layer = new google.maps.FusionTablesLayer({
query: {
  select: 'location',
  from: '1881TVJgnC7HbzM0ZCsBfg72MOlpini6F79a9Vko',
  where: 'ST_INTERSECTS(location, CIRCLE(LATLNG(51.728669, 5.254821), 500))'
}});
layer.setMap(map);

Does anyone have an idea why the 'where'-part is getting ignored?

Était-ce utile?

La solution

The problem is, that in your table 1881TVJgnC7HbzM0ZCsBfg72MOlpini6F79a9Vko there is no column named location, only lat and lon. In these cases, Google Fusion Tables creates a combined column for those two, where lat can be used as a placeholder for both:

var layer = new google.maps.FusionTablesLayer({
    query: {
        select: 'lat',
        from: '1881TVJgnC7HbzM0ZCsBfg72MOlpini6F79a9Vko',
        where: 'ST_INTERSECTS(lat, CIRCLE(LATLNG(51.728669, 5.254821), 500))'
    }
});
layer.setMap(map);

I created a running example on jsFiddle. There you can play around and change the radius using the slider to see how the result changes.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top