[mapguide-users] Spatial query fails: too many objects

von Wartburg, Jan BKSD Jan.vonWartburg at bl.ch
Tue Nov 6 07:27:38 PST 2012


Hello,
When trying to perform a spatial query (excerpt of code is below), I get after around 4 minutes an "500 Internal Server Error" in Firebug. The MapGuide error.log file shows nothing.
I have a layer with around 2500 polygons and a layer with 2500 points (both SDF, same coordinate system). The goal should be to show the points that have a specific serial number and are also inside a polygon.
When reducing the number of objects in the polygon layer to around 2100, everything works fine. It seems MapGuide can't take more polygon objects for a spatial query. Memory isn't a problem: mgserver.exe is only about 80MB during the query.

Has anyone got an idea, on how to process more than the 2100 objects?

Regards,
Jan

MapGuide Open Source 2.2 32bit, WinXP, 2 GB RAM
Basic Layout


Code (excerpt):

      $inputGeometries = new MgPolygonCollection();
      $abfrage = new MgFeatureQueryOptions();

      $layer = $map->GetLayers()->GetItem('Polygonlayer');
      $featureReader = $layer->SelectFeatures($abfrage);

            while ($featureReader->ReadNext())
            {
             $featureGeometryData = $featureReader->GetGeometry('Geometry');
             $featureGeometry = $agfReaderWriter->Read($featureGeometryData);
             $inputGeometries->Add($featureGeometry);
            }

            $geometryFactory = new MgGeometryFactory();
            $mergedGeometries = $geometryFactory->CreateMultiPolygon($inputGeometries);
            $queryOptions = new MgFeatureQueryOptions();

            $selection = new MgSelection($map);

            $layer = $map->GetLayers()->GetItem('Pointlayer');

            $suchfilter = "(" . $schluessel1 . " = " . $jahr . ") AND (" . $schluessel2 . " = " . $serie . ")";

            $queryOptions->SetFilter($suchfilter);

            $queryOptions->SetSpatialFilter('Geometry', $mergedGeometries, MgFeatureSpatialOperations::Inside);

            $featureReader = $layer->SelectFeatures($queryOptions);

            $selection->AddFeatures($layer, $featureReader, 0);

            $selectionXml = $selection->ToXml();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20121106/bb0bcd26/attachment.html>


More information about the mapguide-users mailing list