RE: [mapguide-users] Polygons and Intersection Problem
Could you upload your SDF file with the 2 polygons? -Mark P. From: mapguide-users-boun...@lists.osgeo.org [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Kori Maleski Sent: Thursday, January 15, 2009 9:03 AM To: MapGuide Users Mail List Subject: [mapguide-users] Polygons and Intersection Problem Hi All, Intersection problem: I have an application performs a query on a polygon layer with a point - using intersection with the spatialfilter. The problem is this: The polygon originated from a shapefile - loaded as SDF via studio. The single polygon feature originally was 2 distinct polygons dissolved together via ArcMap. The intersection works only on one of the polygons, and fails to return a feature reader at all when within the other polygon. This fails in both code execution and as a GeFeatureInfo WMS request in the same manner. Has anyone encountered this? Has anyone worked around? Is it better to explode the feature? I require the geometery from each part to do a highlight. Is there an issue with how a shapefile multipolygon is converted to SDF? Or is this an isse with the SelectFeatures functionality? Cheers, Kori Maleski $geometryFactory = new MgGeometryFactory(); // create a coordinate $coordinate = $geometryFactory-CreateCoordinateXY($x,$y); // create a point $point = $geometryFactory-CreatePoint($coordinate); $queryOptions = new MgFeatureQueryOptions(); $queryOptions-SetSpatialFilter('Geometry',$point,MgFeatureSpatialOperat ions::Intersects); $layerResource = new MgResourceIdentifier($layerdefinition); $layer = new MgLayer($layerResource, $resourceService); $layerClassName = $layer-GetFeatureClassName(); $layerFeatureId = $layer-GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer-GetObjectId(); $featureReader = $featureService-SelectFeatures($layerFeatureResource,$layerClassName,$q ueryOptions); ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] Polygons and Intersection Problem
In the studio preview, it fails as well. Using the select tool, clicking on one polygon will highlight/select the entirety, while clicking on the other will yield no highlight/select. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:16 AM, Kori Maleski kori.male...@gmail.comwrote: Mark, I have attached a shapefile with one of the polygons in question. The spatialfilter fails on any dissolve multipolygon like this one. Again, I converted it to sdf via a load procedure. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:08 AM, Mark Pendergraft ma...@meadgilman.com wrote: Could you upload your SDF file with the 2 polygons? -Mark P. *From:* mapguide-users-boun...@lists.osgeo.org [mailto: mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Kori Maleski *Sent:* Thursday, January 15, 2009 9:03 AM *To:* MapGuide Users Mail List *Subject:* [mapguide-users] Polygons and Intersection Problem Hi All, Intersection problem: I have an application performs a query on a polygon layer with a point - using intersection with the spatialfilter. The problem is this: The polygon originated from a shapefile - loaded as SDF via studio. The single polygon feature originally was 2 distinct polygons dissolved together via ArcMap. The intersection works only on one of the polygons, and fails to return a feature reader at all when within the other polygon. This fails in both code execution and as a GeFeatureInfo WMS request in the same manner. Has anyone encountered this? Has anyone worked around? Is it better to explode the feature? I require the geometery from each part to do a highlight. Is there an issue with how a shapefile multipolygon is converted to SDF? Or is this an isse with the SelectFeatures functionality? Cheers, Kori Maleski $geometryFactory = new MgGeometryFactory(); // create a coordinate $coordinate = $geometryFactory-CreateCoordinateXY($x,$y); // create a point $point = $geometryFactory-CreatePoint($coordinate); $queryOptions = new MgFeatureQueryOptions(); $queryOptions-SetSpatialFilter('Geometry',$point,MgFeatureSpatialOperations::Intersects); $layerResource = new MgResourceIdentifier($layerdefinition); $layer = new MgLayer($layerResource, $resourceService); $layerClassName = $layer-GetFeatureClassName(); $layerFeatureId = $layer-GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer-GetObjectId(); $featureReader = $featureService-SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] Polygons and Intersection Problem
One suggestion would be to repair the geometry of the polygons in ArcMap If you go to tool box there is a tool called repair geometry, run that and recreate the sdf file Second option is bring the shape file into AutoCAD and then create SDF from there I had this issue before and when I repaired the geometry in ArcMap it worked fine Thank Shreepad Kori Maleski wrote: In the studio preview, it fails as well. Using the select tool, clicking on one polygon will highlight/select the entirety, while clicking on the other will yield no highlight/select. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:16 AM, Kori Maleski kori.male...@gmail.comwrote: Mark, I have attached a shapefile with one of the polygons in question. The spatialfilter fails on any dissolve multipolygon like this one. Again, I converted it to sdf via a load procedure. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:08 AM, Mark Pendergraft ma...@meadgilman.com wrote: Could you upload your SDF file with the 2 polygons? -Mark P. *From:* mapguide-users-boun...@lists.osgeo.org [mailto: mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Kori Maleski *Sent:* Thursday, January 15, 2009 9:03 AM *To:* MapGuide Users Mail List *Subject:* [mapguide-users] Polygons and Intersection Problem Hi All, Intersection problem: I have an application performs a query on a polygon layer with a point - using intersection with the spatialfilter. The problem is this: The polygon originated from a shapefile - loaded as SDF via studio. The single polygon feature originally was 2 distinct polygons dissolved together via ArcMap. The intersection works only on one of the polygons, and fails to return a feature reader at all when within the other polygon. This fails in both code execution and as a GeFeatureInfo WMS request in the same manner. Has anyone encountered this? Has anyone worked around? Is it better to explode the feature? I require the geometery from each part to do a highlight. Is there an issue with how a shapefile multipolygon is converted to SDF? Or is this an isse with the SelectFeatures functionality? Cheers, Kori Maleski $geometryFactory = new MgGeometryFactory(); // create a coordinate $coordinate = $geometryFactory-CreateCoordinateXY($x,$y); // create a point $point = $geometryFactory-CreatePoint($coordinate); $queryOptions = new MgFeatureQueryOptions(); $queryOptions-SetSpatialFilter('Geometry',$point,MgFeatureSpatialOperations::Intersects); $layerResource = new MgResourceIdentifier($layerdefinition); $layer = new MgLayer($layerResource, $resourceService); $layerClassName = $layer-GetFeatureClassName(); $layerFeatureId = $layer-GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer-GetObjectId(); $featureReader = $featureService-SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users -- View this message in context: http://n2.nabble.com/Polygons-and-Intersection-Problem-tp2163617p2164074.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
RE: [mapguide-users] Polygons and Intersection Problem
I queried the feature programmatically (as a SDF) and tried to assign it to a mgMultiPolygon and it didn't fly. It did work as a mgPolygon though. So, the problem seems to be that the geometry is being stored as a polygon instead of a multipolygon. I have features in my map that aren't connected and I'm able to select them with no problem, but they are multipolygons. This must have something to do with the conversion process in ArcMap or in MapGuide Studio. I don't have ArcMap so I can't comment on what is going on in that arena. Your guess is as good as mine on whether this is an ArcMap issue or a MapGuide Studio issue. However, if you load the data as a SHP file (uncheck convert to SDF in MapGuide Studio) and then view the layer in Studio, you can select either side. So perhaps the solution is to just use the SHP file in your map instead of converting it to SDF. Hope that helps -Mark Pendergraft From: mapguide-users-boun...@lists.osgeo.org [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Kori Maleski Sent: Thursday, January 15, 2009 9:41 AM To: MapGuide Users Mail List Subject: Re: [mapguide-users] Polygons and Intersection Problem In the studio preview, it fails as well. Using the select tool, clicking on one polygon will highlight/select the entirety, while clicking on the other will yield no highlight/select. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:16 AM, Kori Maleski kori.male...@gmail.com wrote: Mark, I have attached a shapefile with one of the polygons in question. The spatialfilter fails on any dissolve multipolygon like this one. Again, I converted it to sdf via a load procedure. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:08 AM, Mark Pendergraft ma...@meadgilman.com wrote: Could you upload your SDF file with the 2 polygons? -Mark P. From: mapguide-users-boun...@lists.osgeo.org [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf Of Kori Maleski Sent: Thursday, January 15, 2009 9:03 AM To: MapGuide Users Mail List Subject: [mapguide-users] Polygons and Intersection Problem Hi All, Intersection problem: I have an application performs a query on a polygon layer with a point - using intersection with the spatialfilter. The problem is this: The polygon originated from a shapefile - loaded as SDF via studio. The single polygon feature originally was 2 distinct polygons dissolved together via ArcMap. The intersection works only on one of the polygons, and fails to return a feature reader at all when within the other polygon. This fails in both code execution and as a GeFeatureInfo WMS request in the same manner. Has anyone encountered this? Has anyone worked around? Is it better to explode the feature? I require the geometery from each part to do a highlight. Is there an issue with how a shapefile multipolygon is converted to SDF? Or is this an isse with the SelectFeatures functionality? Cheers, Kori Maleski $geometryFactory = new MgGeometryFactory(); // create a coordinate $coordinate = $geometryFactory-CreateCoordinateXY($x,$y); // create a point $point = $geometryFactory-CreatePoint($coordinate); $queryOptions = new MgFeatureQueryOptions(); $queryOptions-SetSpatialFilter('Geometry',$point,MgFeatureSpatialOperat ions::Intersects); $layerResource = new MgResourceIdentifier($layerdefinition); $layer = new MgLayer($layerResource, $resourceService); $layerClassName = $layer-GetFeatureClassName(); $layerFeatureId = $layer-GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer-GetObjectId(); $featureReader = $featureService-SelectFeatures($layerFeatureResource,$layerClassName,$q ueryOptions); ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] Polygons and Intersection Problem
Thanks Mark, That clarifies what I am seeing. GetGeometryType() only yields MgPolygon instead of MgMultiPolygon, so it is the conversion to SDF where the Shapefile geometry is lost/changed. The Repair Geometry in ArcMap was already completed and does not affect nor remedy the issue. To workaround the issue (in SDF format): I have to explode the Polygon into 2 Pieces. Then I have to do a spatial filter to retrieve the common ID. Then requery to get both of the desired geometries. I will test my application to see if utilizing the shape file without converting behaves properly with my code and the WMS. Cheers and thanks, Kori Maleski On Thu, Jan 15, 2009 at 11:35 AM, Mark Pendergraft ma...@meadgilman.comwrote: I queried the feature programmatically (as a SDF) and tried to assign it to a mgMultiPolygon and it didn't fly. It did work as a mgPolygon though. So, the problem seems to be that the geometry is being stored as a polygon instead of a multipolygon. I have features in my map that aren't connected and I'm able to select them with no problem, but they are multipolygons. This must have something to do with the conversion process in ArcMap or in MapGuide Studio. I don't have ArcMap so I can't comment on what is going on in that arena. Your guess is as good as mine on whether this is an ArcMap issue or a MapGuide Studio issue. However, if you load the data as a SHP file (uncheck convert to SDF in MapGuide Studio) and then view the layer in Studio, you can select either side. So perhaps the solution is to just use the SHP file in your map instead of converting it to SDF. Hope that helps -Mark Pendergraft *From:* mapguide-users-boun...@lists.osgeo.org [mailto: mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Kori Maleski *Sent:* Thursday, January 15, 2009 9:41 AM *To:* MapGuide Users Mail List *Subject:* Re: [mapguide-users] Polygons and Intersection Problem In the studio preview, it fails as well. Using the select tool, clicking on one polygon will highlight/select the entirety, while clicking on the other will yield no highlight/select. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:16 AM, Kori Maleski kori.male...@gmail.com wrote: Mark, I have attached a shapefile with one of the polygons in question. The spatialfilter fails on any dissolve multipolygon like this one. Again, I converted it to sdf via a load procedure. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:08 AM, Mark Pendergraft ma...@meadgilman.com wrote: Could you upload your SDF file with the 2 polygons? -Mark P. *From:* mapguide-users-boun...@lists.osgeo.org [mailto: mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Kori Maleski *Sent:* Thursday, January 15, 2009 9:03 AM *To:* MapGuide Users Mail List *Subject:* [mapguide-users] Polygons and Intersection Problem Hi All, Intersection problem: I have an application performs a query on a polygon layer with a point - using intersection with the spatialfilter. The problem is this: The polygon originated from a shapefile - loaded as SDF via studio. The single polygon feature originally was 2 distinct polygons dissolved together via ArcMap. The intersection works only on one of the polygons, and fails to return a feature reader at all when within the other polygon. This fails in both code execution and as a GeFeatureInfo WMS request in the same manner. Has anyone encountered this? Has anyone worked around? Is it better to explode the feature? I require the geometery from each part to do a highlight. Is there an issue with how a shapefile multipolygon is converted to SDF? Or is this an isse with the SelectFeatures functionality? Cheers, Kori Maleski $geometryFactory = new MgGeometryFactory(); // create a coordinate $coordinate = $geometryFactory-CreateCoordinateXY($x,$y); // create a point $point = $geometryFactory-CreatePoint($coordinate); $queryOptions = new MgFeatureQueryOptions(); $queryOptions-SetSpatialFilter('Geometry',$point,MgFeatureSpatialOperations::Intersects); $layerResource = new MgResourceIdentifier($layerdefinition); $layer = new MgLayer($layerResource, $resourceService); $layerClassName = $layer-GetFeatureClassName(); $layerFeatureId = $layer-GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer-GetObjectId(); $featureReader = $featureService-SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] Polygons and Intersection Problem
If the polygons are loaded as a Shapefile without the SDF conversion, the spatialfilter query will work on both polygons and the GetFeatureInfo WMS call will work as well. The spatialfilter returns a MgPolygon where the first polygon is the ExteriorRing and the second is the InteriorRing. So this scenario will work fine without converting to SDF. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 11:51 AM, Kori Maleski kori.male...@gmail.comwrote: Thanks Mark, That clarifies what I am seeing. GetGeometryType() only yields MgPolygon instead of MgMultiPolygon, so it is the conversion to SDF where the Shapefile geometry is lost/changed. The Repair Geometry in ArcMap was already completed and does not affect nor remedy the issue. To workaround the issue (in SDF format): I have to explode the Polygon into 2 Pieces. Then I have to do a spatial filter to retrieve the common ID. Then requery to get both of the desired geometries. I will test my application to see if utilizing the shape file without converting behaves properly with my code and the WMS. Cheers and thanks, Kori Maleski On Thu, Jan 15, 2009 at 11:35 AM, Mark Pendergraft ma...@meadgilman.comwrote: I queried the feature programmatically (as a SDF) and tried to assign it to a mgMultiPolygon and it didn't fly. It did work as a mgPolygon though. So, the problem seems to be that the geometry is being stored as a polygon instead of a multipolygon. I have features in my map that aren't connected and I'm able to select them with no problem, but they are multipolygons. This must have something to do with the conversion process in ArcMap or in MapGuide Studio. I don't have ArcMap so I can't comment on what is going on in that arena. Your guess is as good as mine on whether this is an ArcMap issue or a MapGuide Studio issue. However, if you load the data as a SHP file (uncheck convert to SDF in MapGuide Studio) and then view the layer in Studio, you can select either side. So perhaps the solution is to just use the SHP file in your map instead of converting it to SDF. Hope that helps -Mark Pendergraft *From:* mapguide-users-boun...@lists.osgeo.org [mailto: mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Kori Maleski *Sent:* Thursday, January 15, 2009 9:41 AM *To:* MapGuide Users Mail List *Subject:* Re: [mapguide-users] Polygons and Intersection Problem In the studio preview, it fails as well. Using the select tool, clicking on one polygon will highlight/select the entirety, while clicking on the other will yield no highlight/select. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:16 AM, Kori Maleski kori.male...@gmail.com wrote: Mark, I have attached a shapefile with one of the polygons in question. The spatialfilter fails on any dissolve multipolygon like this one. Again, I converted it to sdf via a load procedure. Cheers, Kori Maleski On Thu, Jan 15, 2009 at 10:08 AM, Mark Pendergraft ma...@meadgilman.com wrote: Could you upload your SDF file with the 2 polygons? -Mark P. *From:* mapguide-users-boun...@lists.osgeo.org [mailto: mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Kori Maleski *Sent:* Thursday, January 15, 2009 9:03 AM *To:* MapGuide Users Mail List *Subject:* [mapguide-users] Polygons and Intersection Problem Hi All, Intersection problem: I have an application performs a query on a polygon layer with a point - using intersection with the spatialfilter. The problem is this: The polygon originated from a shapefile - loaded as SDF via studio. The single polygon feature originally was 2 distinct polygons dissolved together via ArcMap. The intersection works only on one of the polygons, and fails to return a feature reader at all when within the other polygon. This fails in both code execution and as a GeFeatureInfo WMS request in the same manner. Has anyone encountered this? Has anyone worked around? Is it better to explode the feature? I require the geometery from each part to do a highlight. Is there an issue with how a shapefile multipolygon is converted to SDF? Or is this an isse with the SelectFeatures functionality? Cheers, Kori Maleski $geometryFactory = new MgGeometryFactory(); // create a coordinate $coordinate = $geometryFactory-CreateCoordinateXY($x,$y); // create a point $point = $geometryFactory-CreatePoint($coordinate); $queryOptions = new MgFeatureQueryOptions(); $queryOptions-SetSpatialFilter('Geometry',$point,MgFeatureSpatialOperations::Intersects); $layerResource = new MgResourceIdentifier($layerdefinition); $layer = new MgLayer($layerResource, $resourceService); $layerClassName = $layer-GetFeatureClassName(); $layerFeatureId = $layer-GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer