Re: [osmosis-dev] Closed ways -> polygons?

2009-12-22 Thread Frederik Ramm
Hi,

David Carmean wrote:
> Not a wizard, but "tenacious" (or OCD, take your pick).  It's beginning to 
> seem like PostGIS has the tools to accomplish what I need.
> Have already managed to have it find closed ways and create polygon 
> geometries 
> for them.  I'll update y'all on my progress when I make some more.

There is a procedural algorithm about making proper polygon geometries 
from relations specified here:

http://wiki.openstreetmap.org/wiki/Relation:multipolygon/Algorithm

If you have a PostGIS implementation that achieves the same, or roughly 
the same, feel free to add it!

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frede...@remote.org  ##  N49°00'09" E008°23'33"

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-22 Thread Anthony
On Mon, Dec 21, 2009 at 8:40 PM, Anthony  wrote:

> On Mon, Dec 21, 2009 at 4:13 PM, Marcus Wolschon wrote:
>
>> What exactly do you mean with converting closed ways into polygons?
>> Closed ways ARE already polygons.
>>
>
> A closed way tagged barrier=fence is a polygon?
>

Or, for a more clear example (barrier=fence is somewhat ambiguous), consider
http://www.openstreetmap.org/browse/way/10997674 and
http://wiki.openstreetmap.org/wiki/Key:area
___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-22 Thread David Carmean
On Tue, Dec 22, 2009 at 12:42:49AM +0100, Frederik Ramm wrote:

[snip]

> This is probably going to be easier than trying to build proper 
> multipolygons from data imported by osmosis, unless you are a real SQL 
> wizard.

Not a wizard, but "tenacious" (or OCD, take your pick).  It's beginning to 
seem like PostGIS has the tools to accomplish what I need.
Have already managed to have it find closed ways and create polygon geometries 
for them.  I'll update y'all on my progress when I make some more.



___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-22 Thread Peter Körner
> Aye.  Part of my problem is that I haven't been able to build osm2pgsql
> under Cygwin/Vista64, and thus can't add the above patch.  Vista64 is the
> only environment I currently possess to run this under; hopefully within
> a few weeks I can build a Linux server with adequate storage and CPU.
Maybe you can run osm2pgsql in a virtualbox and have it connect to the 
postgis db on your vista host system (you can also share the folder 
where the planet.osm resides, so you don't need a big virtual-hd). You 
would then be able to use whatever tools you want in a native unix 
environment, which make things a *lot* easier.


Peter

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread Anthony
On Mon, Dec 21, 2009 at 4:13 PM, Marcus Wolschon wrote:

> What exactly do you mean with converting closed ways into polygons?
> Closed ways ARE already polygons.
>

A closed way tagged barrier=fence is a polygon?
___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread David Carmean
On Tue, Dec 22, 2009 at 12:42:49AM +0100, Frederik Ramm wrote:
> Hi,
> 
> Lennard wrote:
> > David Carmean wrote:
> > 
> >> I found that osm2pgsql omitted several attributes that I require.  Also, 
> >> the 
> >> schema created by osmosis is more suitable to my needs.  
> > 
> > If these attributes are the user, uid, version and timestamp, check out 
> > http://trac.openstreetmap.org/changeset/19144
> 
> And if they are other attributes, then it is very likely that you will 
> be able to modify the osm2pgsql style file to suit your needs.
> 
> This is probably going to be easier than trying to build proper 
> multipolygons from data imported by osmosis, unless you are a real SQL 
> wizard.


Aye.  Part of my problem is that I haven't been able to build osm2pgsql
under Cygwin/Vista64, and thus can't add the above patch.  Vista64 is the
only environment I currently possess to run this under; hopefully within
a few weeks I can build a Linux server with adequate storage and CPU.

I have also considered using a combination of the two toolsets.




___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread Frederik Ramm
Hi,

David Carmean wrote:
> If nothing else it appears that I could write a query using PostGIS functions 
> that will do what I want:
> 
> http://postgis.refractions.net/documentation/manual-1.3/ch06.html#IsClosed

Be advised that multipolygons may consist of any number of outer and 
inner ways which do not have to be closed themselves, they only have to 
form a closed ring. It will certainly be hard (but certainly not 
impossible) to do this with SQL alone.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frede...@remote.org  ##  N49°00'09" E008°23'33"

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread Frederik Ramm
Hi,

Lennard wrote:
> David Carmean wrote:
> 
>> I found that osm2pgsql omitted several attributes that I require.  Also, the 
>> schema created by osmosis is more suitable to my needs.  
> 
> If these attributes are the user, uid, version and timestamp, check out 
> http://trac.openstreetmap.org/changeset/19144

And if they are other attributes, then it is very likely that you will 
be able to modify the osm2pgsql style file to suit your needs.

This is probably going to be easier than trying to build proper 
multipolygons from data imported by osmosis, unless you are a real SQL 
wizard.

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frede...@remote.org  ##  N49°00'09" E008°23'33"

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread Lennard
David Carmean wrote:

> I found that osm2pgsql omitted several attributes that I require.  Also, the 
> schema created by osmosis is more suitable to my needs.  

If these attributes are the user, uid, version and timestamp, check out 
http://trac.openstreetmap.org/changeset/19144

-- 
Lennard

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread David Carmean
On Mon, Dec 21, 2009 at 10:25:52PM +0100, Frederik Ramm wrote:

> Are you aware of osm2pgsql, a tool which has nothing to do with Osmosis 
> but does roughly what you want?

I found that osm2pgsql omitted several attributes that I require.  Also, the 
schema created by osmosis is more suitable to my needs.  

If nothing else it appears that I could write a query using PostGIS functions 
that will do what I want:

http://postgis.refractions.net/documentation/manual-1.3/ch06.html#IsClosed



___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread David Carmean

When I import a .osm file into PostGIS, using osmosis (dumping to a
COPY file), all I get are POINT and LINESTRING WKB geometry columns,
but no POLYGON WKB columns .  The linstrings from what OSM knows as
Closed Ways do have the first and last points with identical coordinates,
but since they are not OGC POLYGON types neither PostGIS nor apps connecting 
to it recognize the feature as a polygon.


On Mon, Dec 21, 2009 at 10:13:02PM +0100, Marcus Wolschon wrote:
> What exactly do you mean with converting closed ways into polygons?
> Closed ways ARE already polygons. What more is there to convert?
> 
> Marcus
> 
> ___
> osmosis-dev mailing list
> osmosis-dev@openstreetmap.org
> http://lists.openstreetmap.org/listinfo/osmosis-dev

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread Frederik Ramm
Hi,

David Carmean wrote:
> I'm attempting to use OSM data, as imported to PostGIS via Osmosis, as 
> layers in a project in some GIS software; I've had some success crafting 
> queries to pull highways into a separate table, and am now working on 
> hydrologic features.  My current roadblock is: how/where can I convert 
> closed OSM ways into polygons?  And then of course there will be 
> multipolygons.

Are you aware of osm2pgsql, a tool which has nothing to do with Osmosis 
but does roughly what you want?

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frede...@remote.org  ##  N49°00'09" E008°23'33"

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread Marcus Wolschon
What exactly do you mean with converting closed ways into polygons?
Closed ways ARE already polygons. What more is there to convert?

Marcus

___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


[osmosis-dev] Closed ways -> polygons?

2009-12-21 Thread David Carmean

I'm attempting to use OSM data, as imported to PostGIS via Osmosis, as 
layers in a project in some GIS software; I've had some success crafting 
queries to pull highways into a separate table, and am now working on 
hydrologic features.  My current roadblock is: how/where can I convert 
closed OSM ways into polygons?  And then of course there will be multipolygons.

Is this something better done in PostGIS?  Is this a feature of osmosis that 
has a different name than I'm looking for?

Thanks.

(I'd also be interested in discussing/sharing queries with people who are 
similarly using OSM data in a PostgreSQL/PostGIS server backend for GIS 
software.)



___
osmosis-dev mailing list
osmosis-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev