Specify Shapefile Geometry

Rod Buchinski rbuchinski at sylvanlake.ca
Tue Apr 11 15:21:21 EDT 2006


Good Day,

 

For some reason mapguide is unable to understand the geometry of my
shapefile. The shapefile is a polygon with the geometry information
contained in the 'Shape' field. However when I use the 'Shape' field in
the following code I get an error which states: "The specified object
was not found - GetItem line 115". 

 

Here is the code:

 

                                                    $byteReader =
$featureReader->GetGeometry('Shape');

                                                    $geometry =
$geometryReaderWriter->Read($byteReader);

                                                    $point =
$geometry->GetCentroid();

                                                    $x =
$point->GetCoordinate()->GetX();

                                                    $y =
$point->GetCoordinate()->GetY();

 

so what I think should happen here is the GetGeometry function should
look at the 'Shape' field, identify that the shapefile is a polygon,
then get the xy coordinates of the centroid of the polygon which is then
sent to another function which can then  zoom to those coordinates. But
I keep getting the error that I mentioned. Could anyone point me in the
right direction?

 

 

Rod

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20060411/f2145a3e/attachment.html


More information about the Mapguide-users mailing list