Dynamic LayerJson - use for closed ways/polygons

34 views
Skip to first unread message

DaveF63

unread,
Nov 16, 2015, 12:14:19 PM11/16/15
to Leaflet
Hi

I'm a hobbyist programmer who's bit out of my depth.

I want to use the code listed here: http://labs.easyblog.it/maps/leaflet-layerjson/examples/overpass.html

to display bars that are mapped as polygons instead of nodes. As listed it works, but if I change the url to 'way' instead of 'node' nothing displays.

 I'm unsure if it's the url that's incorrect or it needs some other code to display nodes at the centre of the polygons.

Any pointers to a solution will be gratefully received

Thanks
Dave F.

ghybs

unread,
Nov 16, 2015, 12:53:13 PM11/16/15
to Leaflet
Hi,

It looks like the plugin Leaflet Dynamic JSON Layer works only with node (markers).
https://github.com/stefanocudini/leaflet-layerJSON

Furthermore, just replacing "node" by "way" gives you the ways included in the given bounds, and each way is specified only by ID of nodes.
So you have absolutely no geographic coordinates in this response, and you need an additional query to get the nodes coordinates.
http://overpass-api.de/api/interpreter?data=[out:json];way%2841.89,12.47,41.90,12.48%29[amenity=bar];out;

So if you really want to use that plugin with something else than nodes, you would probably have more luck by contacting directly the author on the repository GitHub page.

Hope this helps.
Reply all
Reply to author
Forward
0 new messages