Re: [OSM-talk] Converting polygon to OSM way?

2009-07-10 Thread Simon Wood
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=200

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

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

END {
printway 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


Re: [OSM-talk] Converting polygon to OSM way?

2009-07-10 Thread Lennard
si...@mungewell.org wrote:

 Is there a way to convert the same polygon in to an OSM way so that I can
 merge this in and render it as a bounding shape (rather than the default
 rectangle).

I have used osm2poly.pl in the past:

http://trac.openstreetmap.org/browser/applications/utils/osm-extract/polygons


-- 
Lennard

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


Re: [OSM-talk] Converting polygon to OSM way?

2009-07-10 Thread simon
 I have used osm2poly.pl in the past:

 http://trac.openstreetmap.org/browser/applications/utils/osm-extract/polygons


Thanks Lennard, I suspected that there was some 'real' code already
written but didn't know where to find it.

I'll place a reference on the Osmosis page for others trying to do the
same
Simon.



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


Re: [OSM-talk] Converting polygon to OSM way?

2009-07-10 Thread Ldp
si...@mungewell.org wrote:

 Thanks Lennard, I suspected that there was some 'real' code already
 written but didn't know where to find it.

Can also do poly2osm, which is nice for the cases where you want to 
refine an existing poly file.

 I'll place a reference on the Osmosis page for others trying to do the
 same

That would be great, as apparently I had forgotten to do that. :)

-- 
Lennard

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


Re: [OSM-talk] Converting polygon to OSM way?

2009-07-10 Thread Frederik Ramm
Hi,

Simon Wood 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

It's been done already but only for simple polygons without holes, it is 
in svn under applications/utils/osm-extract/polygons/poly2osm.pl (and 
osm2poly.pl).

Bye
Frederik


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


Re: [OSM-talk] Converting polygon to OSM way?

2009-07-09 Thread Russ Nelson
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.

Or come to my talk at SOTM (if you're here) on Sunday morning.

On Jul 10, 2009, at 1:47 AM, si...@mungewell.org wrote:

 I am playing with rendering paper maps, in the process I limit the  
 data to
 a particular area using osmosis with a --bounding-polygon using this  
 type
 of polygon:
 http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format

 Is there a way to convert the same polygon in to an OSM way so that  
 I can
 merge this in and render it as a bounding shape (rather than the  
 default
 rectangle).

 Cheers,
 Simon.
 (aka. Mungewell)


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

--
Russ Nelson - http://community.cloudmade.com/blog - 
http://wiki.openstreetmap.org/wiki/User:RussNelson
r...@cloudmade.com - Twitter: Russ_OSM - 
http://openstreetmap.org/user/RussNelson


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