Running the coastline upload
This page tells you how to run the Almien coastlines (PGS) coastline import script for your area
There are two ways to do this. You choose to have the upload script upload straight to the server, or you can choose to have the script output to a file which you can view in JOSM, and upload from there. In any case, the script constructs large ways with Tag:natural=coastline
Contents |
Basics
svn co http://svn.openstreetmap.org/applications/utils/import/coast_import/
- Download the data from NGA. A script to do that automatically is included. As written, the script will download all 32 regions of the world (hmm... region 13e appears to be missing), comprising 620 megabytes in ZIP compressed format. However, you may only need one of those regions (also called sectors or segments). The regions are explained on the Digital Nautical Chart page on the NGA website. For example, region 20 for Britain is 5.8 megabytes zipped and 12 megabytes unzipped.
cd Data/ sh download.sh unzip shapefile20.zip cd ../
Uploading direct to the server
| Software described on this page or in this section is unlikely to be compatible with API v0.5 deployed on 8 October, 2007. If you have fixed the software, or concluded that this notice does not apply, remove it. |
| Software described on this page or in this section is unlikely to be compatible with API v0.6 deployed on April 20, 2009. If you have fixed the software, or concluded that this notice does not apply, remove it. |
- Edit the script to tell it your OSM username and password
cd coast_import emacs coast_upload.pl
- Run the coast_upload.pl script. The first 4 arguments are the bounding box (lat_min, lat_max, lon_min, lon_max). The 5th argument is the region of the NGA data and defaults to "20" (for Britain). Specify 22 for the Baltic Sea (to reduce harm, the example below contains no coastlines).
perl coast_upload.pl 55.2 55.3 18.2 18.4 22
Uploading/Checking via JOSM
| Software described on this page or in this section is unlikely to be compatible with API v0.6 deployed on April 20, 2009. If you have fixed the software, or concluded that this notice does not apply, remove it. |
This is the preferred method for uploading coastline data.
Run the coast_josm.pl script. The arguments are the same as for the coast_upload.pl script except that the output file go to a file named coast+Y1+Y2+X1+X2.osm where the X/Y are the bounding box used. Simply load into JOSM, run the validator and any other checks you like and then hit upload.
Reasons why this method is preferred:
- You get to check your data before you upload.
- Lower risk of accidentally uploading vast amounts of data.
- The coast_josm.pl script has a built-in simplification algorithm that gets rid of about 75% of nodes from the PGS data.
- coast_josm.pl is already API 0.5 compatible by default.
Uploading/Checking via JOSM without using a script (new!)
The following is an experimental service.
Go to Paul Lenz's web page http://www.lenz-online.de/divers/osm/, select a region and bounding box you are interested in, and the web service creates an OSM file containing the coastline data for you. Download this file and open it in JOSM; make any corrections necessary, and upload.
Now improved: the program creates an additional OSM file where all closed polygones are assumed to be islands, and their nodes are turned into a counter-clockwise order.
Prerequisites
- Perl
- Geo::ShapeFile (note: if CPAN install fails, run fforce install to skip tests)(note: this doesn't seem to work on MacOS)
- To build a package in Debian or Ubuntu etc.:
dh-make-perl [--notest] --build --cpan Geo::ShapeFile
- To build a package in Debian or Ubuntu etc.:
- LWP (for direct upload only)
- WWW::Curl::Easy (for direct upload only)

