문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top