<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>[mapguide-users] OGR / GEOS selection problem</title>
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>GDAL 1.4.0, GEOS 2.2.3.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:
"Tahoma","sans-serif";color:windowtext'> mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <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<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>What version of the GDal and GEOS did you use?<br>
<br>
<br>
<o:p></o:p></p>

<pre>Regards, Kenneth, GEOGRAF A/S<o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre>

<p class=MsoNormal><br>
<br>
Traian Stanev skrev: <o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>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><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Traian</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div>

<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:
"Tahoma","sans-serif";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><o:p></o:p></p>

</div>

</div>

<p class=MsoNormal>&nbsp;<o:p></o:p></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 &quot;fixed&quot;, 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>
<o:p></o:p></p>

<pre>Regards, Kenneth, GEOGRAF A/S<o:p></o:p></pre><pre>&nbsp;<o:p></o:p></pre>

<p class=MsoNormal><br>
<br>
Traian Stanev skrev: <o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi.</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>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><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I have not posted a compiled DLL yet, so Kenneth feel free to do
so, (-:</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Traian</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div>

<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <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><o:p></o:p></p>

</div>

</div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

<div>

<p class=MsoNormal>Hi Kenneth,<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></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.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>Traian<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<blockquote style='margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt'>-----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><o:p></o:p></p>

</div>

<p><span style='font-size:10.0pt'>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><o:p></o:p></p>

</blockquote>

<pre>&nbsp;<o:p></o:p></pre><pre style='text-align:center'><o:p>&nbsp;</o:p></pre><pre
style='text-align:center'>

<hr size=4 width="90%" align=center>

</pre><pre style='text-align:center'><o:p>&nbsp;</o:p></pre><pre
style='text-align:center'><o:p>&nbsp;</o:p></pre><pre style='text-align:center'>&nbsp; <o:p></o:p></pre><pre>&nbsp;<o:p></o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>mapguide-users mailing list<o:p></o:p></pre><pre><a
href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><o:p></o:p></pre><pre><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><o:p></o:p></pre><pre>&nbsp; <o:p></o:p></pre><pre><o:p>&nbsp;</o:p></pre><pre
style='text-align:center'>

<hr size=4 width="90%" align=center>

</pre><pre><o:p>&nbsp;</o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>mapguide-users mailing list<o:p></o:p></pre><pre><a
href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><o:p></o:p></pre><pre><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><o:p></o:p></pre><pre>&nbsp; <o:p></o:p></pre></div>

</body>

</html>