[OSM-talk] How to extract the 12M maritime borders using osmosis?

Michał Brzozowski www.haxor at gmail.com
Tue Mar 1 22:05:46 UTC 2016

These nodes seem to be admin centres of countries. They are part of
the boundary relations.
Try not to reject relations.


On Tue, Mar 1, 2016 at 1:43 PM, Egil Möller <egil at skytruth.org> wrote:
> Hi!
> I'm working for a project that aims to measure IUU (illegal, unregulated and
> unregistered) fishing (globalfishingwatch.org). For this I'd like to be able
> to classify vessel track points as withing various areas, e.g. MPAs,
> economic zones and national waters, of which OSM contains the last one.
> I'm trying to extract this dataset and import it into a PostGIS instance for
> further processing. According to
> http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dmaritime#Territorial_sea_.2812.C2.A0nm_zone.29
> the borders should have these attributes
> boundary=administrative since so many had a problem with grouping it
> together with maritime borders
> maritime=yes to state that this is a maritime border, so it can be rendered
> correctly/different from land borders
> admin_level=2 since it is a national boundary
> border_type=territorial to distinguish it from borders on land
> I tried extracting these borders using
> osmosis/bin/osmosis -v \
>   --read-pbf-fast file=planet-latest.osm.pbf \
>   --tf reject-relations \
>   --tf reject-nodes \
>   --tf accept-ways boundary=administrative maritime=yes admin_level=2
> border_type=territorial \
>   --write-xml file=12M.osm
> I then imported this into PostGIS using
> osmosis/bin/osmosis -v --read-xml file=12M.osm.bz2 --write-pgsimp-dump
> directory=12M
> and the SQL script osmosis/script/pgsimple_load_0.6.sql.
> Now to the problem:
> I see a bunch of nodes all over the place, some even inland:
> http://cdb.io/1QjDRGN
> I see only 40 ways with nodes, all somewhere on the border of Iran:
> http://cdb.io/1QjE2Sq
> I tried the following query to find the number of ways with nodes:
> select count(*) from (select ways.id, st_makeline(nodes.geom) line from
> ways, way_nodes wn,nodes where wn.way_id = ways.id and wn.node_id = nodes.id
> group by ways.id) a where line is not null;
> Thanks in advance,
> Egil
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk

More information about the talk mailing list