Hi there,

I imported the OSM tile layer into Javascript (leaflet), and can see it visually. But how do I access the actual data of the layer? It's vector data, made of points, lines, and polygons, right? How can I access the feature data for some part of the map with Javascript, like as json?

Ex: Get the data for the polylines/polygons making up the streets/blocks of a town.

Thank you

asked 17 Jan '18, 00:03

noncomp's gravatar image

noncomp
21126
accept rate: 0%

edited 17 Jan '18, 00:15

1

If I understand you well, you mean you want to access, for a certain area of the map, the underlying osm data that the OSM renderer used to create the tiles ?

(17 Jan '18, 02:12) edvac

Yes, e.g. if it displays an area with some streets and blocks from OSM, I want to be able to access the vector feature data describing those streets and blocks. Thank you, help is much appreciated!

(17 Jan '18, 02:38) noncomp

You can query the OSM data with Overpass.

There seems to be a framework to do that from Leaflet. Another method is to build the query and parse the result yourself in Javascript.

This page lists some websites that combine Overpass and Leaflet

permanent link

answered 17 Jan '18, 04:09

escada's gravatar image

escada
16.9k16140266
accept rate: 21%

edited 17 Jan '18, 11:09

The link you attached to "framework" doesn't link to a leaflet plugin, have you got a direct link? Thank you!

(17 Jan '18, 06:32) noncomp
1

i've corrected the link. sorry for the inconvenience

(17 Jan '18, 11:09) escada
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×54
×46
×23
×19

question asked: 17 Jan '18, 00:03

question was seen: 1,215 times

last updated: 17 Jan '18, 11:09

powered by OSQA