<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    22.01.2016, 12:48, Kai Muehlbauer kirjoitti:<br>
    <blockquote cite="mid:56A208E9.7090901@uni-bonn.de" type="cite">
      <br>
      <br>
      Am 22.01.2016 um 10:52 schrieb Ari Jolma:
      <br>
      <blockquote type="cite">22.01.2016, 10:06, Kai Muehlbauer
        kirjoitti:
        <br>
        <blockquote type="cite">
          <br>
          <br>
          To quickly check if there is an improvement I used the python
          shapely
          <br>
          package. Converting the outer loop geometry to an shapely
          prepared
          <br>
          geometry and calling 'contains()' with the inner loop
          geometries to
          <br>
          find those fully contained geometries I get an improvement of
          nearly
          <br>
          40% to the former ogr only code.
          <br>
          <br>
          As Even pointed out, there is only
          OGRPreparedGeometryIntersects()
          <br>
          (GEOSPreparedIntersects) exposed within ogrgeometry.cpp. In my
          use
          <br>
          case I would need GEOSPreparedContains to mimic the shapely
          behaviour.
          <br>
        </blockquote>
        <br>
        I made a small test with the attached diff, which prepares the
        <br>
        geometries of the input layer.
        <br>
        <br>
        The input layer had two polygons (boundaries of two Finnish
        <br>
        municipalities) and the method layer had 3091 points, all in
        either one
        <br>
        of the polygons.
        <br>
        <br>
        The improvement is ~15%.
        <br>
        <br>
        I think the prepared geometries could be used by default easily.
        <br>
        Prepared contains test would need addition of the respective
        GEOS method.
        <br>
      </blockquote>
      <br>
      Thanks Ari, I very much appreciate your efforts in testing layer
      intersection. If the prepared contains test could be done within
      the layer intersection then those features can "just be copied"
      without the need of costly intersection calculation. This would
      give a real speedup.
      <br>
    </blockquote>
    <br>
    It seems so, I added the contains test and in this case the total
    speedup is ~80 %.<br>
    <br>
    <blockquote cite="mid:56A208E9.7090901@uni-bonn.de" type="cite">
      <br>
      So, it would need the addition of the OGRPreparedGeometryContains
      method (GEOSPreparedContains) and then enhancing your patch.
      <br>
      Would it work the way as in the attached diff? Or did I miss
      something?
      <br>
    </blockquote>
    <br>
    Attached is my diff, which basically copies to add-to-result code,
    which might be done better.<br>
    <br>
    <blockquote cite="mid:56A208E9.7090901@uni-bonn.de" type="cite">
      <br>
      What are the next steps to get this feature fully implemented?
      <br>
    </blockquote>
    <br>
    The thing is that most of the other layer methods could be enhanced
    this way, which means some more work. I believe the C++ API can be
    enhanced for version 2.1.<br>
    <br>
    Ari<br>
    <br>
    <blockquote cite="mid:56A208E9.7090901@uni-bonn.de" type="cite">
      <br>
      Cheers,
      <br>
      Kai
      <br>
      <br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>