<HTML><HEAD><TITLE>[mapguide-users] OGR / GEOS selection problem</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16441" name=GENERATOR></HEAD>
<BODY dir=ltr text=#000000 bgColor=#ffffff>
<DIV>&nbsp;</DIV>
<DIV>OK thanks. I am suffering bandwidth problems (time bandwidth that is) right now, so that's my excuse for taking time fixing OGR provider bugs. The next issue that I am thinking about fixing is the unicode problem with&nbsp;utf8 strings that Maciej reported, unless some worse problem comes in.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Traian</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT size=2>-----Original Message----- <BR><B>From:</B> mapguide-users-bounces@lists.osgeo.org&nbsp;on behalf of&nbsp;Kenneth, GEOGRAF A/S <BR><B>Sent:</B> Tue 6/12/2007 7:11 PM <BR><B>To:</B> MapGuide Users Mail List <BR><B>Cc:</B> <BR><B>Subject:</B> Re: [mapguide-users] OGR / GEOS selection problem<BR><BR></FONT></DIV><BR>I've finally built it with GDAL 1.4.1, GEOS 3.0.0rc4, mysql, PostGIS and SQLite support. No Oracle support though.<BR>It contains Traians latest updates.<BR><BR><A class=moz-txt-link-freetext href="http://www.hexad.dk/MapGuide/OGR%20Provider%20Release%20FDO%203.2.2%20-%20Proj%204.5.0%20-%20GDal%201.4.1%20-%20Geos%203.0.0rc4%20-%20No%20OCI%20-%20PostGIS%20-%20MySQL%20-%20SQLite.zip">http://www.hexad.dk/MapGuide/OGR%20Provider%20Release%20FDO%203.2.2%20-%20Proj%204.5.0%20-%20GDal%201.4.1%20-%20Geos%203.0.0rc4%20-%20No%20OCI%20-%20PostGIS%20-%20MySQL%20-%20SQLite.zip</A><BR><PRE class=moz-signature cols="72">Regards, Kenneth, GEOGRAF A/S

</PRE>Traian Stanev skrev: 
<BLOCKQUOTE cite="" type="cite">
<STYLE>
<!--
                       
 font-face
        {font-family:Calibri;}
font-face
        {font-family:Tahoma;}
font-face
        {font-family:Consolas;}
                        
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {
        color:purple;
        text-decoration:underline;}
p
        {
        margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {
        font-size:10.0pt;}

div.Section1
        {page:Section1;}
-->
  </STYLE>

<DIV class=Section1>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">GDAL 1.4.0, GEOS 2.2.3.</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<DIV>
<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: rgb(181,196,223) 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN style="FONT-SIZE: 10pt; COLOR: windowtext">From:</SPAN></B><SPAN style="FONT-SIZE: 10pt; COLOR: windowtext"> <A class=moz-txt-link-abbreviated href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</A> [<A class=moz-txt-link-freetext href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</A>] <B>On Behalf Of </B>Kenneth, GEOGRAF A/S<BR><B>Sent:</B> Tuesday, June 12, 2007 10:55 AM<BR><B>To:</B> MapGuide Users Mail List<BR><B>Subject:</B> Re: [mapguide-users] OGR / GEOS selection problem</SPAN></P></DIV></DIV>
<P class=MsoNormal>&nbsp;</P>
<P class=MsoNormal>What version of the GDal and GEOS did you use?<BR><BR><BR></P><PRE>Regards, Kenneth, GEOGRAF A/S</PRE><PRE>&nbsp;</PRE>
<P class=MsoNormal><BR><BR>Traian Stanev skrev: </P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">I just tried it on my Australia states data set which has polygons with 16000+ vertices. It works fine and it is not slow (less than 1 second from mouse click to the selected polygon being highlighted in the AJAX viewer). May be it is a problem in your configuration. FWIW my data came from a SHP file.</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">Traian</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<DIV>
<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN style="FONT-SIZE: 10pt; COLOR: windowtext">From:</SPAN></B><SPAN style="FONT-SIZE: 10pt; COLOR: windowtext"> <A href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</A> [<A href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</A>] <B>On Behalf Of </B>Kenneth, GEOGRAF A/S<BR><B>Sent:</B> Tuesday, June 12, 2007 10:36 AM<BR><B>To:</B> MapGuide Users Mail List<BR><B>Subject:</B> Re: [mapguide-users] OGR / GEOS selection problem</SPAN></P></DIV></DIV>
<P class=MsoNormal>&nbsp;</P>
<P class=MsoNormal>Yes, I have tried doing the selection with a triangle, and it also works, but there is another bug in GEOS, that makes it EXTREMELY slow for any geometries with +2000 points.<BR><BR>I have posted some info on trac about it:<BR><A href="http://trac.osgeo.org/mapguide/ticket/172">http://trac.osgeo.org/mapguide/ticket/172</A><BR><BR>So, the original problem is "fixed", but it opens another problem, which may have more to do with GEOS than with the provider.<BR>I think the related speed problem makes the provider more useless with the fix than without.<BR><BR>I can build a new provider, but I don't have the setup for Oracle and PostGIS.<BR><BR><BR><BR></P><PRE>Regards, Kenneth, GEOGRAF A/S</PRE><PRE>&nbsp;</PRE>
<P class=MsoNormal><BR><BR>Traian Stanev skrev: </P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">Hi.</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">I checked in a temporary fix to this problem. I simply warped one of the coordinates of the input polygon by 10^-10. This is sufficient to make OGR call GEOS to compute the exact intersection. Selection should work correctly now in the AJAX viewer.</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">I have not posted a compiled DLL yet, so Kenneth feel free to do so, (-:</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)">Traian</SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125)"></SPAN>&nbsp;</P>
<DIV>
<DIV style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN style="FONT-SIZE: 10pt">From:</SPAN></B><SPAN style="FONT-SIZE: 10pt"> <A href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</A> [<A href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</A>] <B>On Behalf Of </B>Traian Stanev<BR><B>Sent:</B> Thursday, June 07, 2007 3:46 PM<BR><B>To:</B> MapGuide Users Mail List; MapGuide Users Mail List<BR><B>Subject:</B> RE: [mapguide-users] OGR / GEOS selection problem</SPAN></P></DIV></DIV>
<P class=MsoNormal>&nbsp;</P>
<DIV>
<P class=MsoNormal>Hi Kenneth,</P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal>Thanks for tracking this down. I would try to fix this by bypassing Geos. FDO has utility code that can check for an intersection. We could take the BBOX result and pass that through a real intersection check on the provider side. This way the intersection check would be performed only on geometries that are close enough to the query polygon so the overhead should not be too bad.</P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;</P></DIV>
<DIV>
<P class=MsoNormal>Traian</P></DIV>
<DIV>
<P class=MsoNormal>&nbsp;</P></DIV>
<BLOCKQUOTE style="MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt; MARGIN-RIGHT: 0in">
<DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><SPAN style="FONT-SIZE: 10pt">-----Original Message----- <BR><B>From:</B> <A href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</A>&nbsp;on behalf of&nbsp;Kenneth, GEOGRAF A/S <BR><B>Sent:</B> Thu 6/7/2007 2:54 AM <BR><B>To:</B> MapGuide Users Mail List <BR><B>Cc:</B> <BR><B>Subject:</B> [mapguide-users] OGR / GEOS selection problem</SPAN></P></DIV>
<P><SPAN style="FONT-SIZE: 10pt">Maciej previously reported problems with the OGR provider using PostGIS.<BR><BR>The problem is with the OGR provider.<BR>Se the Trac ticket for details:<BR><A href="http://trac.osgeo.org/mapguide/ticket/172">http://trac.osgeo.org/mapguide/ticket/172</A><BR><BR>I have posted some follow up on the issue, but in hope someone knows a<BR>lot about GEOS, I'm also posting it here:<BR><BR><BR>I have been examining the problem, using a custom build of the OGR<BR>provider. It is true that without GEOS support in OGR, the Intersect<BR>only does a BBOX check.<BR><BR>However, merely enabling GEOS will not work, as the viewer sends a<BR>square that is orthogonal to the axes (like a BBOX). The GEOS library<BR>will interpret this as another BBOX, and only perform the BBOX check<BR>anyway.<BR><BR>When I change the polgyon sent from the viewer to a triangle, it takes<BR>22 seconds to calculate the Intersects result with a polygon with 8000<BR>linesegments. I have a 2+ GHz machine.<BR><BR>It seems that GEOS always builds a full intersection matrix, before<BR>returning the result. This is obviously not optimal for a simple hit<BR>test. Even with this knowledge, I still don't see how it can take 22<BR>seconds to calculate 8000 * 3 intersections.<BR><BR>Can someone explain this, or how to fix it?<BR><BR><BR><BR>--<BR>Regards, Kenneth, GEOGRAF A/S<BR><BR><BR>_______________________________________________<BR>mapguide-users mailing list<BR><A href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</A><BR><A href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</A></SPAN></P></BLOCKQUOTE><PRE>&nbsp;</PRE><PRE style="TEXT-ALIGN: center">&nbsp;</PRE><PRE style="TEXT-ALIGN: center"><HR align=center width="90%" SIZE=4>

  </PRE><PRE style="TEXT-ALIGN: center">&nbsp;</PRE><PRE style="TEXT-ALIGN: center">&nbsp;</PRE><PRE style="TEXT-ALIGN: center">&nbsp; </PRE><PRE>&nbsp;</PRE><PRE>_______________________________________________</PRE><PRE>mapguide-users mailing list</PRE><PRE><A href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</A></PRE><PRE><A href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</A></PRE><PRE>&nbsp; </PRE><PRE>&nbsp;</PRE><PRE style="TEXT-ALIGN: center"><HR align=center width="90%" SIZE=4>

  </PRE><PRE>&nbsp;</PRE><PRE>_______________________________________________</PRE><PRE>mapguide-users mailing list</PRE><PRE><A href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</A></PRE><PRE><A href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</A></PRE><PRE>&nbsp; </PRE></DIV><PRE><HR width="90%" SIZE=4>
_______________________________________________
mapguide-users mailing list
<A class=moz-txt-link-abbreviated href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</A>
<A class=moz-txt-link-freetext href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</A>
  </PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>