Question

How to get road names from .OSM file (OpenStreetMap)

  • 27 July 2017
  • 6 replies
  • 33 views

Badge +10

I have a .OSM file of Australia.

I can extract the roads by choosing the Feature Type "highway"

But the result is missing the names of the roads.

How do I get the names of the roads?

I do get the type of road as an attribute, for example; "residential", "secondary", "tertiary"

But I want the name of the road as well.


6 replies

Badge

Have you tried using an AttributeExposer transformer?

It's possible that your road features have a "name" attribute but it's simply not being exposed on your schema.

 

Badge +2

Hi @nicholas

Not sure if you changed any settings on the parameters of the OSM format Reader , but I see the data you're interested in using the default settings:

I'm using the OpenStreetMap (OSM) XML format Reader not generic XML (Extensible Markup Language) Reader.

Badge +2
When you say result are you writing to another format?

 

If you connect an Inspector transformer in Workbench to the Feature Type "highway" can you see the attributes?

 

 

 

 

Badge +10

I am using the OpenStreetMap (OSM) XML format reader

I am writing to a ESRI file geodatabase.

Below is the attributes that are exposed. I looked in both User Attributes and Feature Attributes but could not see the attribute "name"

Badge +2

@nicholas

You need to expose the attribute as sugegsted by Jake above.

But when you add additional (or expose) attributes to a feature, the schema of the output Feature must be configured to match. So exposing maxspeed means you have to add maxspeed to the Feature Type. Alternatively you can set the attribute definition mode to Automatic.However if the GDB is not set to overwrite in the Navigator panel, then any previous definition of a class will still exist and will not reflect your change. You need to look at the Feature Type Parameter for Table Handling. If set to Create if Needed, then again the class definition will be as it was when the GDB was first created. Set to Drop and Create to use the current schema definition.Attached is a Template file to open in FME Workbench containing sample data and Workspace.osm2gdb.fmwt

 

Badge +10

I have solved it.

When you first add the OpenStreetMap (OSM) Reader, click on the "Parameters" button

Then tick the "Determine feature types by scanning entire dataset" check box

The scanning takes a while, but then all of the tags appear as attributes. Including the tag for the name of the road.

The dialog is not entirely clear. I assumed that the scan was only for feature types (not tags) and was superfluous since I was picking a well-known feature type "highway".

But, it turns out that by scanning the entire dataset, all of the tags associated with each feature type are also exposed.

Reply