<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi!<br>
    <br>
    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.<br>
    <br>
    I'm trying to extract this dataset and import it into a PostGIS
    instance for further processing. According to
<a class="moz-txt-link-freetext" href="http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dmaritime#Territorial_sea_.2812.C2.A0nm_zone.29">http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dmaritime#Territorial_sea_.2812.C2.A0nm_zone.29</a>
    the borders should have these attributes<br>
    <blockquote>boundary=administrative since so many had a problem with
      grouping it together with maritime borders<br>
      maritime=yes to state that this is a maritime border, so it can be
      rendered correctly/different from land borders<br>
      admin_level=2 since it is a national boundary<br>
      border_type=territorial to distinguish it from borders on land<br>
    </blockquote>
    I tried extracting these borders using<br>
    <blockquote>osmosis/bin/osmosis -v \<br>
        --read-pbf-fast file=planet-latest.osm.pbf \<br>
        --tf reject-relations \<br>
        --tf reject-nodes \<br>
        --tf accept-ways boundary=administrative maritime=yes
      admin_level=2 border_type=territorial \<br>
        --write-xml file=12M.osm<br>
    </blockquote>
    I then imported this into PostGIS using<br>
    <blockquote>osmosis/bin/osmosis -v --read-xml file=12M.osm.bz2
      --write-pgsimp-dump directory=12M<br>
    </blockquote>
    and the SQL script osmosis/script/pgsimple_load_0.6.sql.<br>
    <br>
    Now to the problem:<br>
    <br>
    <ul>
      <li>I see a bunch of nodes all over the place, some even inland:
        <a class="moz-txt-link-freetext" href="http://cdb.io/1QjDRGN">http://cdb.io/1QjDRGN</a><br>
      </li>
      <li>I see only 40 ways with nodes, all somewhere on the border of
        Iran: <a class="moz-txt-link-freetext" href="http://cdb.io/1QjE2Sq">http://cdb.io/1QjE2Sq</a><br>
      </li>
    </ul>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    I tried the following query to find the number of ways with nodes:<br>
    <br>
    <blockquote>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;<br>
    </blockquote>
    Thanks in advance,<br>
    Egil<br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </body>
</html>