[mapguide-users] Specify Shapefile Geometry

Jason Birch Jason.Birch at nanaimo.ca
Tue Apr 11 16:05:58 EDT 2006


Hi Rod,
 
Are you sure that "Shape" is the field with the geometry in it?  In my
experience, shapefiles that are loaded by a Load Procedure use a
geometry column of "Geometry".
 
Try echoing out the following:
 
$featureReader->GetClassDefinition()->GetDefaultGeometryPropertyName();
 
BTW;  Sylvan Lake is cool.  My aunt and uncle have a farm near
Bluffton/Rimbey and I've been there for both summers and ice fishing.
Good memories.
 
Jason
 

________________________________

From: Rod Buchinski [mailto:rbuchinski at sylvanlake.ca] 
Sent: Tuesday, April 11, 2006 12:21
To: users at mapguide.osgeo.org
Subject: [mapguide-users] Specify Shapefile Geometry



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/ec45b754/attachment.html


More information about the Mapguide_users mailing list