I'm using the New Zealand Topo50 maps for my basemaps from an ArcGIS map server at http://services.arcgisonline.co.nz/ArcGIS/rest/services/LINZ/geotiffs/MapServer. However, this service has a spatial reference of EPSG:2193 and the tiles are being projected over Europe instead of New Zealand.

I've noticed that vector feature layers, e.g. FeatureLayer and ArcGISDynamicMapServiceLayer, automatically add an output spatial reference to the request so that the returned features are in EPSG:3857 (Web Mercator). Raster layers don't seem to work the same though.

What can I do to have the basemap projected correctly?

My code:

var map = new Map("map", {
  basemap: "topo"

var topo50Layer = new ArcGISDynamicMapServiceLayer(

  • As usual, discovered the answer five minutes after posting this question, having spent three hours trying to figure it out. Please see my answer below.
    – tristanm
    Oct 21, 2014 at 9:38

2 Answers 2


There is an option to specify the SpatialReference when creating the map using the extent option. The dynamic map service layer should automatically project onto the map's spatial reference. It would look something like this

var map = new Map("map", {
  extent: new Extent({
    xmin: <xmin value>,
    ymin: <ymin value>,
    xmax: <xmax value>,
    ymax: <ymax value>,
    spatialReference:{ wkid: 2193 }

A working sample of this is provided on the documentation page. For more information on how to create an Extent, take a look at the API documentation for extent.

  • @tristanm Oops didn't see that you'd posted the answer to your own question. I hope this helps someone else having a similar question but who doesn't have access to map documents on the server and wants to perform this operation on the client side using JavaScript only. Oct 21, 2014 at 11:12
  • Thanks @ashima that's a great answer too for a lot of cases.
    – tristanm
    Oct 21, 2014 at 18:39
  • Manually setting the map's initial extent to 2193 doesn't work, possibly due to a bug ("Map: Geometry (wkid: 2193) cannot be converted to spatial reference of the map (wkid: 102100) init.js:1256"). Other WKIDs do work, though.
    – tristanm
    Oct 22, 2014 at 5:20
  • this is not a bug, both individual coordinate tags like "xmin" and "xmax" along with "wkid" need to be wrapped in quotes to make them valid JSON objects. Oct 23, 2014 at 18:00

ArcGISTiledMapServiceLayer is only useful when the service is in the same spatial reference as the map. This is because it uses the Map Tile resources of the REST API which cannot request re-projected images.

ArcGISDynamicMapServiceLayer uses the Export Map operation which does have the capability to re-project images, although this will be slower.

Changing to ArcGISDynamicMapServiceLayer will request the images in the map's spatial reference.

  • this is not totally correct. ArcGISTiledMapServiceLayer is useful to use with non-mercator map services in applications that leverage the same projection. jsfiddle.net/mca5xqdw Oct 23, 2014 at 18:01
  • You are absolutely correct, @JohnGravois. I've edited my answer to be more general.
    – tristanm
    Oct 23, 2014 at 19:51
  • tristanm++ :) . Oct 24, 2014 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.