[GIS] How to set map extent in Arcgis javascript using spatialReference 4326

arcgis-javascript-apiarcgis-online

I am using Arcgis Javascript API for my map and the map is coming from Arcgis online usng map by ID.

Here is code

         var startExtent = new esri.geometry.Extent(52.37615, 13.11937,52.64877,13.65801,
                  new SpatialReference({wkid:4326}) );

                  var createMapOptions = {
                mapOptions: {
                    extent : startExtent
                },
               };
              arcgisUtils.createMap("c997ee65fad94ce4ae3c3d9618212099","map",createMapOptions).then(function(response){
                 map = response.map;
              }}
             }) 

I want to set map extent according to Berlin city But it is not working for above extent value and SpatialReference:4326.

But when I used this extent
xmin=1231772.125133422&ymin=6464953.10035588&xmax=1843268.35141480187&ymax=7103966.656819923 with SpatialReference:102100 ,It wokrs for me.

I don't know why it not working with SpatialReference:4326.

Does Somebody know Why my code is not working for SpatialReference:4326 and its extent.

I want set map extent according 4326 as shown in code.

Best Answer

I think you have your terms mixed up.

Map extent is the min X, max X, min Y, max Y coordiates. What you're looking to do is change the SRS (spatial reference system); which you cannot do in a web map, as all that I know use a WGS84 Web Mercator, which is the SRS - 102100.

It looks like the two will use different coordinate values to represent the same area, so you will need to identify where Berlin is within the web mercator format; which will use coordinates similar to -7.09,49.69

Related Question