[OSM-talk] Re: [OSM-dev] openlayers alpha

Andrew Loughhead andrew at incanberra.com.au
Mon Aug 28 10:37:27 BST 2006


Joerg Ostertag (OSM Munich/Germany) wrote:
>> Could we short-circuit the GML? If I have the time (there's freemap stuff I
>> need to do for the SoC conference; however it's more likely I can do
>> somethig with it after that) I can have a go at doing something which goes
>> straight from planet to shapefiles. However I would need to research
>> shapefiles first so it wouldn't be a one-day job.
> 
> If I understand you correct; the task is to write a 
>    planet.osm--> Shapefile converter?
> Is there anywhere a short good description for shapefiles you can point me to?

Joerg, I replied to Nick W off list with some of this information too: 
shapelib makes shapefile IO from C pretty easy.  See 
http://shapelib.maptools.org/.  I think OGR (http://www.gdal.org/ogr/) 
includes a (possibly modified) shapelib.

If you really must write your own shapefile code, the format is defined 
in a white paper by ESRI (the company that invented and popularised 
shapefiles). I just found it at 
http://support.esri.com/index.cfm?fa=knowledgebase.whitepapers.viewPaper&PID=25&MetaID=398, 
but if that doesn't work, go to http://support.esri.com/, search on 
"shapefile format", then click the "filter by whitepaper" option near 
the top.  Its a small PDF document.

But - shapelib and / or OGR exist already, are widely used, and work 
well.  In the case of OGR I think you get some free bonus capabilities, 
such as data reprojection, and connection to spatially enabled DBMS such 
as Postgres/PostGIS or SDE.  So an approach that goes through ogr2ogr 
might not be that bad an idea.

The OSM wiki seems to have a few pages that discuss converting OSM to 
shapefile or other widely known formats, including:

http://wiki.openstreetmap.org/index.php/Importing_Planet.osm_into_QGIS
http://wiki.openstreetmap.org/index.php/Converting_OSM_to_GML
http://wiki.openstreetmap.org/index.php/HOWTO_creating_an_OpenLayers_powered_OSM

Maybe there are others.  I don't know what approach is best.  But some 
years ago I used shapelib and it was easy and effective.

Andrew.

> 
> -
> Joerg
> 
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
> 





More information about the talk mailing list