How to build a multipolygon from a list of rings?

3 messages Options
Embed this post
Permalink
Liangxiong Zhu

How to build a multipolygon from a list of rings?

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi there,
 
I have a list of rings which are read from shapefile.  all out rings are clockwise and all hole rings are counterclockwise. After  reading  the OGC spec, it seems that i have to decide for each hole ring that to which out ring it belongs. Which means i have to build a list of Polygon first and then build a MultiPolygon.
 
how could i build a MultiPolygon from a list of rings  directly? It is hard for me to find out the relationship of holes and out rings.
 
Regards,
Abe Zhu

_______________________________________________
geos-devel mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/geos-devel
Frederik Ramm

Re: How to build a multipolygon from a list of rings?

Reply Threaded More More options
Print post
Permalink
Hi,

[hidden email] wrote:
> how could i build a MultiPolygon from a list of rings  directly?

Have you tried using the Polygonizer class to create a collection of
polygons from your data, then make a multipolygon from that?

> It is
> hard for me to find out the relationship of holes and out rings.

I had a similar situation once and cursed GEOS for not allowing me to
find out which ring is inside another - I first had to convert all rings
to polygons individually, then I could check each of these polygons
(using the "contains" method) whether it was contained in any of the
others, and this then allowed me to construct a proper createPolygon
call (or multiple of those).

Bye
Frederik
_______________________________________________
geos-devel mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/geos-devel
strk

Re: How to build a multipolygon from a list of rings?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Liangxiong Zhu
Consider looking at shp2pgsql.c from PostGIS project.
It does contain code to build SFS geometries out of a set of rings.

--strk;

On Fri, Oct 09, 2009 at 02:51:55PM +0800, [hidden email] wrote:

> Hi there,
>
> I have a list of rings which are read from shapefile.  all out rings are clockwise and all hole rings are counterclockwise. After  reading  the OGC spec, it seems that i have to decide for each hole ring that to which out ring it belongs. Which means i have to build a list of Polygon first and then build a MultiPolygon.
>
> how could i build a MultiPolygon from a list of rings  directly? It is hard for me to find out the relationship of holes and out rings.
>
> Regards,
> Abe Zhu
> _______________________________________________
> geos-devel mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/geos-devel

--

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple!
_______________________________________________
geos-devel mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/geos-devel