[mapguide-users] set and zoom to selection
Scott Hameister
ScottH at mPower-tech.com
Thu Feb 1 18:11:26 EST 2007
Is it Empty empty or an empty Schema.big difference in trying to help.
I also noticed you didn't do a Selection.Open.So you've instantiated the
object.but haven't opened it.I've had weird issues between intitializing,
save and Open that confuse me.It seems if I initialize the object, do a
save, and then Open I get a blank set.if I do an Open Only I get the current
selection.
_____
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Knight, Gregory
Sent: Thursday, February 01, 2007 4:02 PM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] set and zoom to selection
Me again. Im trying to work through some of the PHP examples and convert
them to C#... I not doing a very good job. but Im making some progress.
I have a feature source - to which Ive applied a basic filter. I am able to
read feature geometry and attributes from my featureReader. now id like to
convert that filtered feature to a selection. I think there is a problem
with the last four lines in the code below. because, if I write the
selectionXml variable to the task pane, it is empty.
Any idea what Im doing wrong here?
// create a filter to select the specified parcel
String filter = "PID_LONG LIKE '%" + parcelID + "%'";
MgResourceIdentifier featureResId = new
MgResourceIdentifier("Library://BRA/Data/Bos_Parcels_06.FeatureSource");
MgFeatureQueryOptions queryOptions = new
MgFeatureQueryOptions();
queryOptions.SetFilter(filter);
// get the parcel feature from the feature source
MgAgfReaderWriter geometryReaderWriter = new
MgAgfReaderWriter();
MgFeatureReader featureReader =
featureService.SelectFeatures(featureResId, "Bos_Parcels_06", queryOptions);
featureReader.ReadNext();
// get the parcel geometry
MgByteReader byteReader = featureReader.GetGeometry("Geometry");
MgGeometry geometry = geometryReaderWriter.Read(byteReader);
MgPoint point = geometry.GetCentroid();
double x = point.GetCoordinate().GetX();
double y = point.GetCoordinate().GetY();
// create a selection, save the selection as XML
MgLayerBase layer = map.GetLayers().GetItem("Bos_Parcels_06");
MgSelection selection = new MgSelection(map);
selection.AddFeatures(layer, featureReader, 0);
String selectionXml = selection.ToXml();
_____
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Knight, Gregory
Sent: Thursday, February 01, 2007 12:07 PM
To: MapGuide Users Mail List
Subject: [mapguide-users] set and zoom to selection
I have an application that allows a user to get parcel info for a given
parcel id. The application flow is much like many of the available
developer samples:
- Get parcel id from user
- Return link to parcel
- User clicks on link to zoom to parcel
- User can then select parcel to display parcel attributes
This works, but I think there is much more user interaction here than
necessary. Once I have the parcel id from the user (and I know its valid),
Id like to automatically zoom to that parcel and display the relevant parcel
data in the task pane. Im a little stumped on how I might do this, as the
examples that illustrate setting active selection, zooming to active
selection, etc - all rely on using page load events / javascript, XML
selection sets, etc - again, all more user interaction than I'd like.
I'm assuming I can do this with one page (as opposed to 2 or 3) via the web
api - but I cant find any examples. Can someone point me in the right
direction here?
Many thanks,
Greg
_____
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/20070201/30b776c3/attachment-0001.html
More information about the mapguide-users
mailing list