Coordinates from Event Layer
I have workflow that works against an event layer that needs to the zoom the extent of the selected feature. The issue I am having is that event layers do not return geometry as part of the query so I can't extract the extent as I would for a typical query against a featureset. The event layer does have Latitude and Longitude as attribute values. How can I use the Latitude and Longitude values from the resultant feature set to generate an extent that I can zoom to in Web Mercator?
Thanks,
Aaron
-
Hi Aaron,
If you create a MapPoint out of your X and Y and assign it a new SpatialReference using WKID 4326, you should be able to call ESIR.ArcGIS.Client.Projection.WebMercator.FromGeogaphic(...) to convert it to Web Mercator.
(http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Projection.WebMercator~FromGeographic.html) http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Projection.WebMercator~FromGeographic.html
--Ryan
0 -
Ryan,
I have the MapPoint created and have assigned .X, .Y and .SpatialReference (4326); however, I'm not following you on how to project to Web Mercator (102113) through Workflow.
Thanks,
Aaron
0 -
Ryan,
I followed the approach described in this post, https://support.geocortex.com/Forums/Thread.aspx?pageid=0&mid=2&ItemID=20&thread=45726&postid=132159, to re-project and the coordinates look good. The problem I am having now is zooming to the extent of the projected point using the following Value for the "SetMapExtent" activity: BridgeGeometry.Extent().expand(3); where BridgeGeometry is of type Geometry. The map doesn't seem to change extents.
Thanks,
Aaron
0 -
Hi Aaron,
The issue here is that the extent of a MapPoint has zero width and height. The map will not zoom to an extent with no size. The Expand(3) method just triples the width and height, so you are still left with zero size. You've got a couple options:
- You can pass your MapPoint into a BufferTask activity and buffer it by an actual distance (say 100 Meters) to get a Polygon. This will have an extent with a valid size that you can use.
- You could also just create a new extent from your MapPont by using an Assign activity with an expression like:
new Envelope(point.X - 100, point.Y - 100, point.X + 100, point.Y + 100)
--Ryan
0 -
Ryan,
I went with option two and everything is working as expected now. Thanks, for clarifying the issue and providing two solutions.
Aaron
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer