Select to view content in your preferred language

spatial reference not working?

873
2
Jump to solution
09-27-2012 08:05 AM
YuLuo1
by
New Contributor
I am using ArcGIS Flex API to write some web map application and got some tricky problems with the spatial reference.

Here is the code:
vMap = new com.esri.ags.Map(); initialExtent = new Extent(-98,33,-97,34, new SpatialReference(4326)); //initialExtent = new Extent(-11131949.0793274, 3456807.64460123, -10241393.1529812 , 4347363.57094742, new SpatialReference(4326)); vMap.extent = initialExtent; vLayer = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"); vMap.addLayer(vLayer);


I  am using the latitude and longitude, so I choose the 4326 spatial reference. But the map keep using the default 102100.
Basically, the
initialExtent = new Extent(-98,33,-97,34, new SpatialReference(4326));
only show the map around (0,0) because the lat/lon is too small in UTM coordinate system.

initialExtent = new Extent(-11131949.0793274, 3456807.64460123, -10241393.1529812 , 4347363.57094742, new SpatialReference(4326));

will still gives me the right extent.

Any help will be greatly appreciated.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DasaPaddock
Esri Regular Contributor
0 Kudos
2 Replies
DasaPaddock
Esri Regular Contributor
0 Kudos
YuLuo1
by
New Contributor
That fixes it . Thank you!

Try using a WebMercatorExtent instead:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/geometry/WebMercatorExtent.html

Or you can use WebMercatorUtil to convert from geographic to web mercator:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/utils/WebMercatorUtil.html
0 Kudos