Question

How to order tags in OSM Writer


I am working on a workspace that reads Tourism Information Office data from an XML file, converts the attributes to OSM tags and writes it to an OSM file. This OSM file is then processed by a program called OsmAndMapCreator to create an obf (OsmAnd Binary Format) file for the OsmAnd mobile application.

 

Each office has a collection of characteristics and services so there is more than 1 tag for each node. The order in which those tags are written to the OSM file is important for how the feature will appear on the map. A tourism information office that has parking or picnic tables still needs to appear as a tourism information office no matter what else they offer.

 

The OSM writer does not maintain the order of its reader or User Attributes list. In my reader and writer the tourism tag is at the top but for some reason, it is always the last one in my OSM file.

 

 

Here's 2 nodes where it creates a problem.

This node shows up as a picnic table on my map but it should appear has a tourism information office.

<node lat="46.7175626" lon="-74.603273" id="-142">

 

<tag k="leisure" v="picnic_table"/>

 

<tag k="amenity" v="charging_station;parking;sanitary_dump_station;telephone"/>

 

<tag k="shop" v="yes"/>

 

<tag k="facebook" v="http://www.facebook.com/TourismeMontTremblant/"/>

 

<tag k="internet_access" v="wlan"/>

 

<tag k="telephone" v="1 877 425-2434"/>

 

<tag k="email" v="info@mont-tremblant.ca"/>

 

<tag k="wheelchair" v="yes"/>

 

<tag k="tourism" v="information"/>

 

</node>

 

This one shows as a parking lot.

<node lat="46.03219" lon="-74.204372" id="-35">

 

<tag k="leisure" v="children_playground;picnic_table"/>

 

<tag k="amenity" v="parking"/>

 

<tag k="shop" v="yes"/>

 

<tag k="internet_access" v="wlan"/>

 

<tag k="telephone" v="1 888 322-7030 (4235)"/>

 

<tag k="email" v="tourisme@valdavid.com"/>

 

<tag k="wheelchair" v="yes"/>

 

<tag k="website" v="http://www.valdavid.com"/>

 

<tag k="name" v="Bureau d'accueil touristique de Val-David"/>

 

<tag k="tourism" v="information"/>

 

</node>

 

 

 

In both cases, manually editing the osm file to move <tag k="tourism" v="information"/> at the top fixed my problem and made those 2 points appear as tourism information office on my map.

 

So how do I fix that ? How do I force FME to keep my tags in the same order as the user attributes ?


2 replies

Badge +15

Hi @groschialeux,

I don't know a thing about OSM XML, but I guess using an XMLTemplater together with a Text File Writer should do the job.

I've found this article you might find helpful: https://knowledge.safe.com/articles/30940/xml-writing-with-xmltemplater.html

Hi @groschialeux,

I don't know a thing about OSM XML, but I guess using an XMLTemplater together with a Text File Writer should do the job.

I've found this article you might find helpful: https://knowledge.safe.com/articles/30940/xml-writing-with-xmltemplater.html

That's a good idea. I will take a look at this. Thank you !

Reply