NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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

accept rate: 0%

edited 17 Jan '18, 00:15


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

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

i've corrected the link. sorry for the inconvenience

(17 Jan '18, 11:09) escada

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 17 Jan '18, 00:03

question was seen: 5,917 times

last updated: 17 Jan '18, 11:09

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum