Zooming to graphic

3614
2
Jump to solution
03-02-2015 04:16 PM
JanaPfefferova
New Contributor

Hi,

I created offline geocoding with composite address locator according to this sample Geocoding | ArcGIS for Developers . I just used "Single Line Input" in address.Add.

Everything works fine in terms of displaying the correct location with the graphic overlay.

But the map is not zooming to that location it's just kind of centring. How should I change the code to zoom to the found location?

Could someone help me out with it?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
AsserSwelam1
Occasional Contributor

Hi Jana,

The way it created in the sample is to create an extent out of the results which mostly more than one location then zoom to that extent.

In your case I believe you have only one point as a result to zoom to, so here is the way to zoom and center a point, you can change the scale value as desired.

                await MyMapView.SetViewAsync(_graphicsOverlay.Graphics[0].Geometry);

                await MyMapView.ZoomToScaleAsync(560);

Thanks,

Asser

View solution in original post

2 Replies
AsserSwelam1
Occasional Contributor

Hi Jana,

The way it created in the sample is to create an extent out of the results which mostly more than one location then zoom to that extent.

In your case I believe you have only one point as a result to zoom to, so here is the way to zoom and center a point, you can change the scale value as desired.

                await MyMapView.SetViewAsync(_graphicsOverlay.Graphics[0].Geometry);

                await MyMapView.ZoomToScaleAsync(560);

Thanks,

Asser

View solution in original post

JanaPfefferova
New Contributor

Thanks a lot!

0 Kudos