On 10 Jul 2009 07:27:33 +0200
"Russ Nelson" <r...@cloudmade.com> wrote:

> It's very straightforward.  Just needs a program to take the one file  
> format and turn it into a different file format.  Just create a bunch  
> of new nodes, connect them together with a way, then add the  
> appropriate metadata for your renderer.  Number the nodes and ways  
> with negative numbers.
> 

Yes, it relatively easy... I'm just lazy and wondered if it had been done 
already (with some code which really did it right - ie. copying with holes 
etc.).

My simple hack method was:
head -n -2 alberta2pts.txt | awk -f poly2way.awk  > test.osm

poly2way.awk
--
BEGIN {
        offset=2000000

        print "<?xml version='1.0' encoding='UTF-8'?>"
        print "<osm version='0.5' generator='poly2way'>"
}

{
        if (NR > 3 ) {
                print "   <node id='-" NR+offset "' visible='true' lat='" $2+0 
"' lon='" $1+0 "'>"
                print "   </node>"
        }
}

END {
        print "   <way id='-" NR + 1 "' visible='true'>"
        
        for (count=4; count < NR; count++) {
                print "      <nd ref='-" count+offset "'/>"
        }
        print "      <nd ref='-" 4+offset "'/>"
        print "      <tag k='boundary' v='boundary'/>"
        print "   </way>"

        print "</osm>"
}
--

_______________________________________________
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk

Reply via email to