Select to view content in your preferred language

ZoomTo Bing Geocode BestView for United States

1155
1
11-25-2011 01:26 AM
ChrisSmith
Emerging Contributor
Hi

Using ESRI Bing geocoder for search address 'United States' the best view returned is :

SouthWest.Lon = 177.348754
SouthWest.Lat =26.677207

NorthEast.Lon = -55.848747
NorthEast.Lat = 75.762794

When creating points and converting from WGS84 to WebMercator then constructing an Envelope for the Map to ZoomTo(), the map zooms to Europe, Asia & North Africa.

When drawing out the coordinates on paper the best view spans the date line (I have tried Geometry.NormalizeCentralMeridian())

Here is some sample code...(coordinates have been hardcoded and switched round multiple times in the new Envelope() constructor in an attempt to try and get it to work)

var southWest = Transform.GeographicToWebMercator(new MapPoint(177.348754, 26.677207, new SpatialReference(4326)));

var northEast = Transform.GeographicToWebMercator(new MapPoint(-55.848747, 75.762794, new SpatialReference(4326)));  
             
var envelope = new Envelope(northEast.X, southWest.Y, southWest.X, northEast.Y);

envelope.SpatialReference = new SpatialReference(102100);

SomeMap.ZoomTo(Geometry.NormalizeCentralMeridian(envelope));



am I missing anything obvious?
any pointers/help would be much appreciated

Chris
0 Kudos
1 Reply
ChrisSmith
Emerging Contributor
bit more info, normalizing the geometry doesn't update it...

before normalizing to central meridian...
envelope
{-6217054.07748237,3083200.58936723,19742372.9881015,13268766.2816879}
    base {ESRI.ArcGIS.Client.Geometry.Geometry}: {-6217054.07748237,3083200.58936723,19742372.9881015,13268766.2816879}
    Extent: {-6217054.07748237,3083200.58936723,19742372.9881015,13268766.2816879}
    Height: 10185565.692320695
    Width: 25959427.065583907
    XMax: 19742372.988101542
    xmax: 19742372.988101542
    xmin: -6217054.077482366
    XMin: -6217054.077482366
    ymax: 13268766.281687925
    YMax: 13268766.281687925
    YMin: 3083200.58936723
    ymin: 3083200.58936723

after normalizing to central meridian...
normalizedEnvelope
{-6217054.07748237,3083200.58936723,19742372.9881015,13268766.2816879}
    [ESRI.ArcGIS.Client.Geometry.Envelope]: {-6217054.07748237,3083200.58936723,19742372.9881015,13268766.2816879}
    Extent: {-6217054.07748237,3083200.58936723,19742372.9881015,13268766.2816879}
    GeometryChanged: null
    SpatialReference: {ESRI.ArcGIS.Client.Geometry.SpatialReference}
0 Kudos