[OSM-dev] osm2shp converter & ferries
Frederik Ramm
frederik at remote.org
Mon May 9 10:53:21 BST 2011
Uffek,
On 05/09/11 11:33, uffeK wrote:
> We have compiled the osm2shp converter by Frederik Ramm and have tried to
> extend it with additional fields, in order to include ferries.
>
> We call it this way, with the last 2 lines having been added:
>
> shapefile_new(2, SHPT_ARC, "roads", 9,
> "osm_id", FTInteger, 11,
> "name", FTString, 48,
> "ref", FTString, 16,
> "type", FTString, 16,
> "oneway", FTInteger, 1,
> "bridge", FTInteger, 1,
> "maxspeed", FTInteger, 3,
> "route", FTString, 10,
> "route_duration", FTString, 10);
That is not enough. The above does create the columns in the shape, but
you will also have to fill them! Check the process_osm_way definition in
the same file, and add something like (pseudocode)
if (way has route tag)
{
extract route_duration;
add row to "roads" shape with route and duration
}
Also make sure that you find the place where it adds roads to the shape,
and provide empty values for the last two columns there.
> We can also see "route_duration" is sometimes tagged as "duration" for some
> ferries.
Since this is pure C code, you can easily write code that extracts
"duration" and "route_duration" and writes to the shape whatever has a
value.
Note that osm2shp doesn't support relations; if you need to evaluate
route relations (as opposed to just route=ferry tags), you will have to
enhance osm2shp or choose another tool entirely.
Bye
Frederik
More information about the dev
mailing list