Zoom and Center not working on MapView using MapImageLayer

1057
4
Jump to solution
08-10-2018 05:56 AM
DavidKucharski
New Contributor II

I declare a MapImageLayer using the following. It is a service hosted locally.

var baseMapLayer = new MapImageLayer({
url: "https://esridev.nsamedia.com/arcgis/rest/services/States/MapServer"
});

I apply it to a new BaseMap.

var basemapDefault = new Basemap({
baseLayers: [baseMapLayer],
title: "Custom Basemap",
id: "myBasemap"
});

I apply the basemapDefault to a Map object and then use that Map object in my MapView

var map = new Map({
basemap: basemapDefault,
layers: [highlightGeographyLyr, colorOverlayLyr, hatchOverlayLyr, locationOverlayLyr, competitorOverlayLyr] 
});

var view = new MapView({
container: "viewDiv", 
map: map, 
zoom: 20, 
center: [-119.41793, 36.7783] 
});

Everything works correctly except for my zoom and center property. No matter what I put in the zoom or center, the map initially loads that same way. 

What I am doing wrong?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

David,

  Sure you just use the scale property instead of zoom.

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

David,

   If your basemap is not tiled then the zoom property has no bearing in your situation.

0 Kudos
DavidKucharski
New Contributor II

Robert, thank you again. 

My basemap is not tiled. So is there any way to set the my map so when initially loaded it will be at a specific area at a specific scale? I am having a user setup their map the way they want it, so when they come back into it, the map looks the same. 

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

David,

  Sure you just use the scale property instead of zoom.

DavidKucharski
New Contributor II

Thank you.

0 Kudos