[mapguide-users] set and zoom to selection
Knight, Gregory
Gregory.Knight.bra at cityofboston.gov
Mon Feb 5 10:58:51 EST 2007
Im not sure if its Empty empty or an empty schema... how do I make that
determination?
I have tried adding opening and saving the selection as you suggest, but
that doesn't seem to help. What is the proper sequence of things -
Initiate, Save, Open?
Do you have any additional ideas here?
________________________________
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Scott
Hameister
Sent: Thursday, February 01, 2007 6:11 PM
To: 'MapGuide Users Mail List'
Subject: RE: [mapguide-users] set and zoom to selection
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/20070205/1456f926/attachment-0001.html
More information about the mapguide-users
mailing list