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 would like to show this type of relations in a simple map with Openlayers. http://www.openstreetmap.org/api/0.6/relation/1637735/full

I'm specially interested in being able to show tags as legend. Do you know how can I do it in the simplest way possible?

I'm not sure if Openlayers has already a package to display relations.

share|improve this question
    
To generate the layer use new OpenLayers.Layer.GML("Polygon", "file.osm", {format: OpenLayers.Format.OSM, style: {strokeColor: "blue", .... etc –  JorgePM Apr 16 '12 at 16:38

2 Answers 2

up vote 1 down vote accepted

There are two solutions that I use for REST applications, most of the time I use both:
1)Store the tags in a array and use JavaScrip to keep track of tags related to a feature.
2)Populate the feature with some or all the tags with an iteration.

For example, load the geometries into a layer with one request, load the tags with other request, relate them with the ID. Now to have some resources working like the bubble popup, pupulate the layer with some important or desired attributes.

share|improve this answer
    
Ok I figure it out I can parse the xml with JQuery and it seems reasonable. Do you use jQuery also or something else? –  JorgePM Apr 16 '12 at 13:42
    
I started with JQuery + BackboneJS, than I rewrote the code to use Extjs4. It worked fine with both solutions. If you plan to stick with JQuery I strongly recommend you to use something to manage your models like Backbonejs, otherwise you will spend a lot of time writing low level code. –  Pablo Apr 16 '12 at 14:02
    
For the server side I use Django + Tastypie + Postgis. They rock! –  Pablo Apr 16 '12 at 14:04

you can check OpenLayers GeoRSS Example. it is all about geotagged information. for more about GeoRSS, you can read it.

and GeoRSS Model:

<geo:Point>
   <geo:lat>55.701</geo:lat>
   <geo:long>12.552</geo:long>
</geo:Point>

and usage :

<?xml version="1.0"?>
 <rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
   <channel>
     ...
     <item>
       <title>An example annotation</title>
       <link>http://example.com/geo</link>
       <description>Just an example</description>
       <geo:lat>26.58</geo:lat>
       <geo:long>-97.83</geo:long>
     </item>
     ...
   </channel>
 </rss>

i hope it helps you...

share|improve this answer

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.