var bbox = new esri.geometry.Extent({ "xmin": 175.0, "ymin": 15.0, "xmax": -175.0, "ymax": 25.0, "spatialReference": { "wkid": 4326 } });
Hello All,I'm using the web mercator projection and wrapAround180 option to provide seamless panning across the antimeridian. I would like to set the extent of the map to an area which in geographic coordinates would cross the antimeridian, e.g.var bbox = new esri.geometry.Extent(175.0,15.0,-175.0,25.0, new esri.SpatialReference({ wkid:4326 }));map.setExtent(esri.geometry.geographicToWebMercator(bbox),true);However this does not work, centering instead on central Africa and setting the zoom level to the maximum.Can someone please suggest the appropriate way to do this?Thanks!--john
//fake coords to avoid discontinuity - doesn't seem to help // var bbox = new esri.geometry.Extent({xmin:175.0,ymin:-5.0,xmax:185.0,ymax:5.0, spatialReference:{ wkid:4326 }}); var bbox = new esri.geometry.Extent({xmin:175.0,ymin:-5.0,xmax:-175.0,ymax:5.0, spatialReference:{ wkid:4326 }}); var merc = esri.geometry.geographicToWebMercator(bbox); esri.geometry.normalizeCentralMeridian([merc], 'http://maps.ngdc.noaa.gov/rest/services/Geometry/GeometryServer', function(geometries){ map.centerAndZoom(geometries[0],true); }, function() { console.log("error normalizing"); });
var bbox = new esri.geometry.Extent({xmin:175.0,ymin:-5.0,xmax:-175.0,ymax:5.0, spatialReference:{ wkid:4326 }}); esri.geometry.normalizeCentralMeridian([bbox], 'http://maps.ngdc.noaa.gov/rest/services/Geometry/GeometryServer', function(geometries){ var merc = esri.geometry.geographicToWebMercator(geometries[0]); map.centerAndZoom(merc,true); }, function() { console.log("error normalizing"); });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.