[Talk-us] Tools for importing National Hydrography Dataset?

Chris Lawrence lordsutch at gmail.com
Thu Apr 9 22:02:53 BST 2009


On Thu, Apr 9, 2009 at 3:09 PM, Ian Dees <ian.dees at gmail.com> wrote:
> On Thu, Apr 9, 2009 at 3:02 PM, Jeffrey Ollie <jeff at ocjtech.us> wrote:
>>
>> Do any tools exist for importing data from the National Hydrography
>> Dataset?  It'd be nice to have creeks/rivers/lakes in OSM instead of
>> blank spaces, especially when I generate maps for my Garmin GPS.
>
> Jefft, we've been talking about doing it for quite a while. I have a
> shapefile to OSM converter written in Java that is most of the way there
> [1]. Christopher Schmidt has one written in Python [2].
>
> A few of us have uploaded local NHD data, but the nationwide import has not
> started yet. Personally, I'm waiting for 0.6 to come out so we can take
> advantage of the diff import features.
>
> [1] http://redmine.yellowbkpk.com/projects/list_files/geo
> [2] http://crschmidt.net/blog/354/polyshp2osm/

Speaking of polyshp2osm.py, here's a link to the version I modified
for the TIGER place boundary data.  The major difference is that it
now supports "multipolygons" imported from Shapefiles, which are used
in TIGER to represent non-contiguous places (cities with exclaves
etc.) instead of just dumping them as "degenerate rings."  I did make
some changes in the code that are a little boundary-specific that
probably should be refactored up into the "make your customizations
here" section.

Also included is my script that merges duplicated nodes in the
shapefile, which are common along shared boundaries.  It's not quite
as good a solution as using line-based borders, but I couldn't wrap my
brain around an easy way to program an automated conversion from
polygons to lines in any sensible way.  This one requires the Python
lxml library (on Debian/Ubuntu, apt-get install python-lxml).  Thus
far the filenames are hardcoded, which I may fix later.

Hopefully these will be of some use for others.

Both are at http://www.lordsutch.com/osm/

I also uploaded the Mississippi place boundaries to OSM; they seem to
be rendering in the minutely-updated server at Cloudmade and are
starting to show up in the main slippy map.  I'm going to work on
automating the conversion process and then bring in the rest over the
next few days (the MS upload took about 8 hours for ~100k nodes and
ways, which seems around average for a state).


Chris




More information about the Talk-us mailing list