Converting OSM data into GIS readable format

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting OSM data into GIS readable format

S Knox
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 - Get better answers from someone who knows. Try it now.
_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Converting OSM data into GIS readable format

Petter Reinholdtsen

[S Knox]
> 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

Looking at the script I suspect the command line should be

  awk -f script.awk

While the file planet.osm must be in the working directory when you
run it.

Happy hacking,
--
Petter Reinholdtsen


_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: Converting OSM data into GIS readable format

johnrobot
Ah, nice to know that there are more Manifold users contributing to OSM out there. I, too, put in a request  to Manifold some time ago to have them add support for OSM files. Hopefully, there are more users like us, and we can get the feature in the next update.

Magnus



Petter Reinholdtsen wrote
[S Knox]
> 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

Looking at the script I suspect the command line should be

  awk -f script.awk

While the file planet.osm must be in the working directory when you
run it.

Happy hacking,
--
Petter Reinholdtsen


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