Thanks a lot all for your replies!<br>It turns out that there was no problem with the geometry itself, but with another geometry that I generated from it; this second geometry was *empty*, but not *null* and so I was failing a test to catch it that would turn it out to my first (correct) geometry. <br>
Thanks again for your time and have a good evening!<br> Jo<br><br><div class="gmail_quote">2009/8/2 <span dir="ltr"><<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Send geos-devel mailing list submissions to<br>
<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:geos-devel-owner@lists.osgeo.org">geos-devel-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of geos-devel digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: (Mateusz Loskot)<br>
2. Re:(not) Empty geometry (Jo)<br>
3. Re: Re:(not) Empty geometry (Mateusz Loskot)<br>
4. Re: (not) Empty geometry (Jo) (Jo)<br>
5. Re: Re: (not) Empty geometry (Jo) (Mateusz Loskot)<br>
6. Polygonizer returns inner rings on their own? (Frederik Ramm)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sun, 02 Aug 2009 21:57:47 +0100<br>
From: Mateusz Loskot <<a href="mailto:mateusz@loskot.net">mateusz@loskot.net</a>><br>
Subject: Re: [geos-devel] (not) Empty geometry<br>
To: GEOS Development List <<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>><br>
Message-ID: <<a href="mailto:4A75FDCB.4020104@loskot.net">4A75FDCB.4020104@loskot.net</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Jo wrote:<br>
> Hi, I am having some troubles with a polygon, that is seen by geos as<br>
> empty (and thus returning GetNumPoints()=0);<br>
> I dont understand what might be wrong with this polygon, since the<br>
> output of geos::io::WKTWriter shows a polygon with many<br>
> coordinates...<br>
<br>
It's impossible to judge unless you show a snippet of code<br>
that presents how you construct a polygon object using GEOS?<br>
What's the source data?<br>
<br>
Best regards,<br>
--<br>
Mateusz Loskot, <a href="http://mateusz.loskot.net" target="_blank">http://mateusz.loskot.net</a><br>
Charter Member of OSGeo, <a href="http://osgeo.org" target="_blank">http://osgeo.org</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sun, 2 Aug 2009 22:16:29 +0100<br>
From: Jo <<a href="mailto:doublebyte@gmail.com">doublebyte@gmail.com</a>><br>
Subject: [geos-devel] Re:(not) Empty geometry<br>
To: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
Message-ID:<br>
<<a href="mailto:23ab5f0a0908021416g27919536o256fd515f79acacc@mail.gmail.com">23ab5f0a0908021416g27919536o256fd515f79acacc@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
I just realized the mailing list truncated my last message; here it is<br>
(without the attach!)<br>
<br>
Hi,<br>
I am having some troubles with a polygon, that is seen by geos as empty (and<br>
thus returning GetNumPoints()=0); I dont understand what might be wrong with<br>
this polygon, since the output of geos::io::WKTWriter shows a polygon with<br>
many coordinates... I append that output here;<br>
I also put an image of the polygon on:<br>
<br>
<a href="http://ladybug.no-ip.org/files/emptyPolygon.png" target="_blank">http://ladybug.no-ip.org/files/emptyPolygon.png</a><br>
<br>
It would be great if anybody had some suggestions: Im realy lost here!<br>
Thanks in advance for ur help,<br>
<br>
cheers,<br>
<br>
Jo<br>
<br>
<br>
2009/8/2 <<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a>><br>
<br>
> Send geos-devel mailing list submissions to<br>
> <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
><br>
> To subscribe or unsubscribe via the World Wide Web, visit<br>
> <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
> or, via email, send a message with subject or body 'help' to<br>
> <a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a><br>
><br>
> You can reach the person managing the list at<br>
> <a href="mailto:geos-devel-owner@lists.osgeo.org">geos-devel-owner@lists.osgeo.org</a><br>
><br>
> When replying, please edit your Subject line so it is more specific<br>
> than "Re: Contents of geos-devel digest..."<br>
><br>
><br>
> Today's Topics:<br>
><br>
> 1. (not) Empty geometry (Jo)<br>
><br>
><br>
> ----------------------------------------------------------------------<br>
><br>
> Message: 1<br>
> Date: Sun, 2 Aug 2009 21:51:41 +0100<br>
> From: Jo <<a href="mailto:doublebyte@gmail.com">doublebyte@gmail.com</a>><br>
> Subject: [geos-devel] (not) Empty geometry<br>
> To: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
> Message-ID:<br>
> <<a href="mailto:23ab5f0a0908021351w53233efehdb82784d0c7248aa@mail.gmail.com">23ab5f0a0908021351w53233efehdb82784d0c7248aa@mail.gmail.com</a>><br>
> Content-Type: text/plain; charset="iso-8859-1"<br>
><br>
> Skipped content of type multipart/alternative-------------- next part<br>
> --------------<br>
> A non-text attachment was scrubbed...<br>
> Name: polygon.wkt<br>
> Type: application/octet-stream<br>
> Size: 51117 bytes<br>
> Desc: not available<br>
> Url :<br>
> <a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj</a><br>
><br>
> ------------------------------<br>
><br>
> _______________________________________________<br>
> geos-devel mailing list<br>
> <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
><br>
> End of geos-devel Digest, Vol 82, Issue 3<br>
> *****************************************<br>
><br>
<br>
<br>
<br>
--<br>
"#define QUESTION ((bb) || !(bb))" (Shakespeare)<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/1c757e2c/attachment-0001.html" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/1c757e2c/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Sun, 02 Aug 2009 22:30:06 +0100<br>
From: Mateusz Loskot <<a href="mailto:mateusz@loskot.net">mateusz@loskot.net</a>><br>
Subject: Re: [geos-devel] Re:(not) Empty geometry<br>
To: GEOS Development List <<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>><br>
Message-ID: <<a href="mailto:4A76055E.1040308@loskot.net">4A76055E.1040308@loskot.net</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Jo wrote:<br>
> I just realized the mailing list truncated my last message; here it is<br>
> (without the attach!)<br>
<br>
Sorry, I didn't see any source code in your message.<br>
See how it is archived:<br>
<br>
<a href="http://lists.osgeo.org/pipermail/geos-devel/2009-August/004293.html" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/2009-August/004293.html</a><br>
<br>
Or you mean polygon.obj attachment?<br>
<br>
<a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj</a><br>
<br>
Best regards,<br>
--<br>
Mateusz Loskot, <a href="http://mateusz.loskot.net" target="_blank">http://mateusz.loskot.net</a><br>
Charter Member of OSGeo, <a href="http://osgeo.org" target="_blank">http://osgeo.org</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Sun, 2 Aug 2009 22:56:43 +0100<br>
From: Jo <<a href="mailto:doublebyte@gmail.com">doublebyte@gmail.com</a>><br>
Subject: [geos-devel] Re: (not) Empty geometry (Jo)<br>
To: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
Message-ID:<br>
<<a href="mailto:23ab5f0a0908021456x3928293al32e4e1186dfc1896@mail.gmail.com">23ab5f0a0908021456x3928293al32e4e1186dfc1896@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi,<br>
The attach was only the wkt definition of the polygon...<br>
Things are gettin a bit clearer now: the polygon is also valid and<br>
empty on OGR (so I guess no prob in importing it to geos).<br>
I think is outside the scope of this mailing list to tell how Im<br>
importing it into OGR, but I ll do it anyway :-)<br>
<br>
<br>
while( (poFeature = poLayer->GetNextFeature()) != NULL )<br>
{<br>
OGRGeometry *poGeometry;<br>
poGeometry = poFeature->GetGeometryRef();<br>
<br>
if( poGeometry != NULL && wkbFlatten(poGeometry->getGeometryType())<br>
== wkbPolygon )<br>
{<br>
OGRPolygon *poPolygon = (OGRPolygon*) poGeometry;<br>
DoStuffWithGEOS()<br>
}<br>
}<br>
Inside DoStuffWithGEOS(), I export it to text and import it (from<br>
text) to Geos. I guess this is all working fine cause it works for all<br>
the hundreds of polygons that I have, so I guess this one is "special"<br>
:-)<br>
I would have to look at it with a bit more detail!!<br>
It looks fine in QGis thought...<br>
<br>
<a href="http://ladybug.no-ip.org/files/emptyPolygon.png" target="_blank">http://ladybug.no-ip.org/files/emptyPolygon.png</a><br>
<br>
cheers,<br>
Jo<br>
<br>
<br>
<br>
Jo wrote:<br>
>* I just realized the mailing list truncated my last message; here it is<br>
*>* (without the attach!)<br>
*<br>
Sorry, I didn't see any source code in your message.<br>
See how it is archived:<br>
<br>
<a href="http://lists.osgeo.org/pipermail/geos-devel/2009-August/004293.html" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/2009-August/004293.html</a><br>
<br>
Or you mean polygon.obj attachment?<br>
<br>
<a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj</a><br>
<br>
Best regards,<br>
<br>
<br>
<br>
2009/8/2 <<a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a>><br>
<br>
> Send geos-devel mailing list submissions to<br>
> <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
><br>
> To subscribe or unsubscribe via the World Wide Web, visit<br>
> <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
> or, via email, send a message with subject or body 'help' to<br>
> <a href="mailto:geos-devel-request@lists.osgeo.org">geos-devel-request@lists.osgeo.org</a><br>
><br>
> You can reach the person managing the list at<br>
> <a href="mailto:geos-devel-owner@lists.osgeo.org">geos-devel-owner@lists.osgeo.org</a><br>
><br>
> When replying, please edit your Subject line so it is more specific<br>
> than "Re: Contents of geos-devel digest..."<br>
><br>
><br>
> Today's Topics:<br>
><br>
> 1. (not) Empty geometry (Jo)<br>
><br>
><br>
> ----------------------------------------------------------------------<br>
><br>
> Message: 1<br>
> Date: Sun, 2 Aug 2009 21:51:41 +0100<br>
> From: Jo <<a href="mailto:doublebyte@gmail.com">doublebyte@gmail.com</a>><br>
> Subject: [geos-devel] (not) Empty geometry<br>
> To: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
> Message-ID:<br>
> <<a href="mailto:23ab5f0a0908021351w53233efehdb82784d0c7248aa@mail.gmail.com">23ab5f0a0908021351w53233efehdb82784d0c7248aa@mail.gmail.com</a>><br>
> Content-Type: text/plain; charset="iso-8859-1"<br>
><br>
> Skipped content of type multipart/alternative-------------- next part<br>
> --------------<br>
> A non-text attachment was scrubbed...<br>
> Name: polygon.wkt<br>
> Type: application/octet-stream<br>
> Size: 51117 bytes<br>
> Desc: not available<br>
> Url :<br>
> <a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/9e51e147/polygon.obj</a><br>
><br>
> ------------------------------<br>
><br>
> _______________________________________________<br>
> geos-devel mailing list<br>
> <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
><br>
> End of geos-devel Digest, Vol 82, Issue 3<br>
> *****************************************<br>
><br>
<br>
<br>
<br>
--<br>
"#define QUESTION ((bb) || !(bb))" (Shakespeare)<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/778c5fc1/attachment-0001.html" target="_blank">http://lists.osgeo.org/pipermail/geos-devel/attachments/20090802/778c5fc1/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Sun, 02 Aug 2009 23:12:56 +0100<br>
From: Mateusz Loskot <<a href="mailto:mateusz@loskot.net">mateusz@loskot.net</a>><br>
Subject: Re: [geos-devel] Re: (not) Empty geometry (Jo)<br>
To: GEOS Development List <<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>><br>
Message-ID: <<a href="mailto:4A760F68.8050609@loskot.net">4A760F68.8050609@loskot.net</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Jo wrote:<br>
> Hi,<br>
> The attach was only the wkt definition of the polygon...<br>
> Things are gettin a bit clearer now: the polygon is also valid and<br>
> empty on OGR (so I guess no prob in importing it to geos).<br>
> I think is outside the scope of this mailing list to tell how Im<br>
> importing it into OGR, but I ll do it anyway :-)<br>
><br>
><br>
> while( (poFeature = poLayer->GetNextFeature()) != NULL )<br>
> {<br>
> OGRGeometry *poGeometry;<br>
> poGeometry = poFeature->GetGeometryRef();<br>
><br>
> if( poGeometry != NULL && wkbFlatten(poGeometry->getGeometryType())<br>
> == wkbPolygon )<br>
> {<br>
> OGRPolygon *poPolygon = (OGRPolygon*) poGeometry;<br>
> DoStuffWithGEOS()<br>
<br>
What does this return?<br>
<br>
poPolygon->getExteriorRing()->getNumPoints()<br>
<br>
> }<br>
> }<br>
> Inside DoStuffWithGEOS(), I export it to text and import it (from<br>
> text) to Geos.<br>
<br>
You don't need to go through text export/import.<br>
Just dump OGR geometry as GEOS geometry using<br>
OGRGeometry::exportToGEOS() method:<br>
<br>
<a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogr_geometry.h#L118" target="_blank">http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogr_geometry.h#L118</a><br>
<br>
And check if GEOS geomtetry is OK now.<br>
<br>
Best regards,<br>
--<br>
Mateusz Loskot, <a href="http://mateusz.loskot.net" target="_blank">http://mateusz.loskot.net</a><br>
Charter Member of OSGeo, <a href="http://osgeo.org" target="_blank">http://osgeo.org</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Mon, 03 Aug 2009 00:22:25 +0200<br>
From: Frederik Ramm <<a href="mailto:frederik@remote.org">frederik@remote.org</a>><br>
Subject: [geos-devel] Polygonizer returns inner rings on their own?<br>
To: <a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
Message-ID: <<a href="mailto:4A7611A1.5080202@remote.org">4A7611A1.5080202@remote.org</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Hi,<br>
<br>
why is it that the (C++) Polygonizer, when given the following four<br>
geometries,<br>
<br>
"LINESTRING(1 1, 1 10, 10 10)"<br>
"LINESTRING(10 10, 10 1, 1 1)"<br>
"LINESTRING(20 20, 20 30, 30 30, 30 20, 20 20)"<br>
"LINESTRING(3 3, 3 4, 4 4, 4 3, 3 3)"<br>
<br>
(1 and 2 together form a shell, 3 forms a disjunct shell, 4 forms an<br>
inner ring of 1+2)<br>
<br>
returns a collection of three polygons:<br>
<br>
POLYGON ((1.00 1.00, 1.00 10.00, 10.00 10.00, 10.00 1.00, 1.00 1.00),<br>
(3.00 3.00, 4.00 3.00, 4.00 4.00, 3.00 4.00, 3.00 3.00))<br>
POLYGON ((20.00 20.00, 20.00 30.00, 30.00 30.00, 30.00 20.00, 20.00 20.00))<br>
POLYGON ((3.00 3.00, 3.00 4.00, 4.00 4.00, 4.00 3.00, 3.00 3.00))<br>
<br>
I'm ok with the first and second, but the third one has already been<br>
used as a "hole" inside the first and should not be returned again - or<br>
is there a misunderstanding on my part?<br>
<br>
Bye<br>
Frederik<br>
<br>
--<br>
Frederik Ramm ## eMail <a href="mailto:frederik@remote.org">frederik@remote.org</a> ## N49°00'09" E008°23'33"<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geos-devel" target="_blank">http://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
<br>
End of geos-devel Digest, Vol 82, Issue 4<br>
*****************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>"#define QUESTION ((bb) || !(bb))" (Shakespeare)<br><br>