[OSM-talk] How to extract the 12M maritime borders using osmosis?
Egil Möller
egil at skytruth.org
Tue Mar 1 12:43:19 UTC 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20160301/b500fd2b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20160301/b500fd2b/attachment.sig>
More information about the talk
mailing list