[mapguide-users] insertion point
Farah
farah at egovernments.org
Thu Nov 9 06:59:06 EST 2006
Hi,
You can get the coordinates of :the centroid of the selected geometry by
doing:
MgAgfReaderWriter geometryReaderWriter = new MgAgfReaderWriter();
while(featureReader.ReadNext())
{
MgByteReader byteReader = featureReader.GetGeometry("Geometry");
//Get the geometry of the feature, find the centroid and the x,
y points of the centroid
MgGeometry geometry = geometryReaderWriter.Read(byteReader);
MgPoint point = geometry.GetCentroid();
x = point.GetCoordinate().GetX();
y = point.GetCoordinate().GetY();
}
Regards,
Farah
_____
From: Willem Schwarte [mailto:willem at giskit.nl]
Sent: Thursday, November 09, 2006 3:31 PM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] insertion point
Hi,
I still need some help here please.
Here is an excerpt of my code to get the selected item on the map:
$queryOptions->SetFilter($selectionString);
$featureReader = $featureService->SelectFeatures($layerFeatureResource,
$layerClassName, $queryOptions);
$sel = "";
while ($featureReader->ReadNext())
{
$bordnummer = $featureReader->GetString('TEXTSTRING');
$coord = $featureReader->GetCoordinate()->GetX();
}
Now it errors on GetCoordinate. Do I need to use something else to get the
coordinates? I can't really find anything helpful in the devmanual.
Thx,
Willem
_____
Van: Willem Schwarte [mailto:willem at giskit.nl]
Verzonden: woensdag 8 november 2006 16:49
Aan: users at mapguide.osgeo.org
Onderwerp: RE: [mapguide-users] insertion point
Ok great, as I said, I already can read the properties from the selected
object, just didn't know how to get the coordinates. thx
_____
Van: Knight, Gregory [mailto:Gregory.Knight.bra at cityofboston.gov]
Verzonden: woensdag 8 november 2006 15:17
Aan: users at mapguide.osgeo.org
Onderwerp: RE: [mapguide-users] insertion point
To get feature properties from the active selection, you need to do a few
things.
First you need to retrieve the selection from the viewer. Depending on the
viewer you are using, this can be retrieved directly from the server from
your development environment or from the viewer via javascript.
Once you have the selection info, you will need to perform the basic MG
initialization, create resource and feature services, etc. The next step is
to connect to your map resource using the feature reader and selection info
to read the feature properties that you need. The X and Y coordinates can
be retrieved with GetCoordinate().GetX() and GetCoordinate.GetY()
respectively.
This is the basic idea anyways.
There are some good examples in the Dev Guide that illustrate this process.
Check out Ch 3 - Working With Feature Data.
Cheers,
Greg
_____
From: Willem Schwarte [mailto:willem at giskit.nl]
Sent: Wednesday, November 08, 2006 8:21 AM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] insertion point
Hi,
How can I get the X and Y values of the insertion point of an object that is
currently selected on the map. I can get the properties of the object, but
now I also need the insertion point x and y values.
thanks
_____
The substance of this message, including any attachments, may be
confidential, legally
privileged and/or exempt from disclosure pursuant to Massachusetts
law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and
delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20061109/ec1ed137/attachment.html
More information about the Mapguide-users
mailing list