This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to convert osm way xml to openlayers feature?

1

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.

asked 18 Apr '13, 12:57

amritkarma's gravatar image

amritkarma
684212941
accept rate: 11%

Source code available on GitHub .