[OSM-dev] osm2spatialite!

Daniel Sabo danielsabo at gmail.com
Fri Jan 14 05:33:13 GMT 2011


I know this has been discussed here before, so it's seemed like the right place to share.

I have a beta version of an osm2spatialite script written in python. Right now it's only handles osm xml files, but there should be a pbf version in the future. Ram is an issue so I'm not sure python is the best choice in the long term. Right now a 450MB xml file takes ~900MB to process. It is fairly speedily though as long as you don't run out of memory.

All the files I've tested work but I'd be interested to know if you find places it doesn't. Neither the GOES C api and SpatialLite have a version of BuildArea so most of the code is devoted to assembling multipolygons, so that's the area it's most likely to produce different results than osm2pgsql.

Caveats:
Beware that it doesn't know how to insert into an existing sqlite database yet, so if you use --force it will just erase the sqlite file.

It only supports WGS84 databases for now.

It expects sqlite to have spatialite built in, if you need to call some sql to load the module add it to the trydb function.

The SQL in a mapnik style file written for osm2pgsql needs to be tweaked a bit, more details here: http://code.google.com/p/maps4mac/wiki/osm2spatialite

The script: http://maps4mac.googlecode.com/files/osm2spatialite-0.1.zip


More information about the dev mailing list