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?

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top