Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am displaying the osm data through a popup with openlayers. For now i am using the overpass api to get data.

But my app needs to reflect the rapidly changing data i.e. one changes the data then uses my app, then they need to see the new data.

The one minute lag of overpass api is not acceptable, so i have decided to use the

  1. skel mode of overpass api to display feature,
  2. Get id and geometry
  3. query the feature from osm database

this way i can limit the data usage also.

Now i have an Openlayers Vector Layer using OpenLayers.Format.OSM. i can add features to it.

i need to convert an xml data in this format to an OpenLayers.Feature.Vector.

share|improve this question
You can use json with mapquest example:… – Mapperz Apr 18 '13 at 17:18
i don't think osm provides response in json format. And any other service cannot provide updated data as fast as i need. (every other service will be at least 1 min late, which is not acceptable). – neogeomat Apr 19 '13 at 9:44
up vote -1 down vote accepted

Use a format to read new features, parse it and add it to the layer.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

You need to use a vector layer with OpenLayers.Format.OSM

This page on the OSM Wiki has a wonderful example:OpenLayers osm file example

share|improve this answer
i already have that layer. now i need to add a feature to it, which comes after parsing the xml file. Something like "add elements one by one onto a vector layer" – neogeomat Apr 27 '13 at 19:20
If you need to convert from the XML to a feature, after you have added it as a layer, you'll have to do that through custom code. I don't think there is any function which will do that for you. – Devdatta Tengshe Apr 28 '13 at 4:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.