More

Arcgis JS API WMS Layer zoom without basemap


I have an OGC WMS resource which I am adding to a map without any basemap. To view this resource I have to zoom in, so I have decided to set a center point and zoom to this point.

The problem is that instead of zooming in to the point I have set, it zooms out because the map has -1 zoom value.

I would like to know if someone knows any way to avoid this and set a real zoom value to the map.


When you set center and zoom via the map's constructor options, the map assumes web mercator and the de-facto standard map zoom levels. Probably the easiest way to do what you want is to use an extent instead of using center and zoom when creating your map.

There's a sample that let's you select your spatial reference and then prints the map's extent so you can create an extent from that.