Select to view content in your preferred language

drill down on map

3729
6
06-09-2010 10:54 AM
ThaoNguyen
Emerging Contributor
Hi,
I'm looking for a sample that when I double click a selected state, the map is zoomed in at street level of that state.  I tried MyMap.Zoom(), but sometimes the selected state is out of view.  Is there a way we can get the position of the selected state and zoom in the middle?

I also create a context menu which has Drill down option, clicking on this option will do the same as above.  Again, I want to do what I state above, but haven't found a way :(.

The drill down event handler method:

void drillDownMenuItem_Click(object sender, RoutedEventArgs e)
        {
            MyMap.Zoom(2.0); //test
         }

Thanks!!
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor
You can zoom to any geometry, so if you have the geometry or envelope of the state, you can simply do:
myMap.ZoomTo(geometry);

This will fit the state in the view.
0 Kudos
ThaoNguyen
Emerging Contributor
You can zoom to any geometry, so if you have the geometry or envelope of the state, you can simply do:
myMap.ZoomTo(geometry);

This will fit the state in the view.


Thanks!
This is another question but is related to drilldown.

On a map, I have 3 states selected or highlighted, when right clicking 1 state, a menu is displayed and I can select "Drill down" option.  I want to get the geometry of the clicked point, then do the query task which returns me the data of that state.  I am able to do the query task, but now, I don't know how to get the right geometry of the clicked state.  As you know, giving the wrong geometry will return wrong data.
I really appreciate your help!!
0 Kudos
dotMorten_esri
Esri Notable Contributor
Do you want the polygon of the state, or the point of where you right-clicked?
0 Kudos
ThaoNguyen
Emerging Contributor
Do you want the polygon of the state, or the point of where you right-clicked?


I tried the point where I clicked, but it didn't work right.  When setting the geometry of the point to Query object, it doesn't return any data.  I guess I need the Polygon, but I don't know all the numbers to create the Polygon.

The way I get the point is MouseButtonEventArgs.getPosition(myMap), then I create a MapPoint object using the Point x and y.  Don't know what I missed.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The geometry doesn't need to be a polygon. It's working with a point as well.
Here is a sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery

It looks like you missed to convert the screen coordinates to map coordinates.
Add something like:
mapPoint = myMap.ScreenToMap(point);
0 Kudos
ThaoNguyen
Emerging Contributor
The geometry doesn't need to be a polygon. It's working with a point as well.
Here is a sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SpatialQuery

It looks like you missed to convert the screen coordinates to map coordinates.
Add something like:
mapPoint = myMap.ScreenToMap(point);



Thanks!!  Using ScreenToMap works.  I didn't know this.   Yes, I agree that it doesn't have to be a polygon, I was answering the previous question by another member about either point or polygon.   Point didn't work for me before converting to map point.
I'm very new to esri wpf.
0 Kudos