Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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: open.mapquestapi.com/nominatim/v1/… –  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

2 Answers 2

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

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
1  
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
1  
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

 
discard

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.