[OSM-talk] Converting OSM data into GIS readable format

S Knox roxyknox at yahoo.co.uk
Sat Sep 1 12:44:08 BST 2007


I have been contributing to Open Street Map slowly but surely for a while now.

My question is this: as the database grows in size and becomes genuinely useful to organisations and people, is there any way of getting data out without knowing quite a lot about scripting etc?

I say this because I come from a GIS (and hence Windows) background. I would like to be able to view data from Open Street Map in a GIS, and I am quite sure that I'm not alone. 

I have been trying to use the script which converts planet.osm into MID/MIF files. I realised after a while this is an AWK script (my lack of programming/UNIX knowledge shows through here), so downloaded awk95.exe from http://cm.bell-labs.com/, put the script in a script.awk file and tried to call it using the following from the DOS command line:

awk - f script.awk planet.osm 

however it doesn't seem to do anything. Can anyone advise (I realise that many of you work in UNIX so not expecting any easy answers!)

Also is there anything else in the pipeline to make the data more accessible to users within other applications, e.g. GIS?

I did put a request in to Manifold.net (for those not aware a very good GIS product that is currently retailing at approx £120 thanks to the favourable exchange rate and very competitive pricing) to include support for OSM data in their next release, but it appears that such functionality is not in the latest version 8. 

Any ideas from anyone?

Many thanks

Stephen Knox

The script file I am using is enclosed below for reference:

BEGIN{
 i=-1;j=-1; 
 system("rm -f planet.mi?");
printf("version 300\ncharset \"utf-8\"\n\
coordsys earth projection 1, 104\n\
delimiter \",\"\n\
columns 1\n\
cat integer\n\
data\n") >"planet.mif";
}
{
        if ($1 == "  <node id=") 
         {
          nodes[i++]=$2; nodelat[$2]=$4;
          nodelon[$2]=$6;
         } 
        if ($1 == "  <segment id=") 
         {
          seg[j++]=$2; seg_start[j]=$4;
          seg_end[j]=$6;
         } 
}
END{
for(k=0;k<i;k++)
{
 print "point",nodelat[nodes[k]],nodelon[nodes[k]] >>
"planet.mif"
 print nodes[k] >> "planet.mid"
}
for(k=0;k<j;k++)
{
 print
"line",nodelon[seg_start[k]],nodelat[seg_start[k]],nodelon[seg_end[k]],nodelat[seg_end[k]]
>>"planet.mif"
 print seg[k] >> "planet.mid"
}
}' planet.osm




      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20070901/5c047d0c/attachment.html>


More information about the talk mailing list