Select to view content in your preferred language

Implementing Map Image Layer

2631
3
Jump to solution
02-10-2013 06:00 PM
BenjaminStewart
Deactivated User
I am trying to customize one of the ESRI story map pages, and I am encountering a javascript error that is confounding me. I want to use a MapImageLayer to display a picture on top of the map, but the image doesn't show up.

The sample can be found here (ignore the lack of captions)
http://geographyis.com/MapStories/mapStory/index.html
The code to add the layer is below, when it runs I get a javascript error in the MapImageLayer.js file (line 19): TypeError: _25 is null

Has anyone successfully implemented this? Any suggestions? Anything?

_map = new esri.Map("map"); _map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer(BASEMAP_URL));   var mil = new esri.layers.MapImageLayer({  'id': 'mtAlbertMap' }); var mi = createMapImage(); _map.addLayer(mil); mil.addImage(mi); ... function createMapImage() {  var mi = new esri.layers.MapImage({    'extent': { 'xmin': -13963916, 'ymin': 6386341, 'xmax': -13942805, 'ymax': 6405759, 'spatialReference': { 'wkid': 3857 } },    'href': "http://geographyis.com/MapStories/mapStory/images/Mount_Albert_Edward_Trail.jpg"  });  return(mi); }  
0 Kudos
1 Solution

Accepted Solutions
SteveCole
Honored Contributor
Take a look at this thread I started a couple weeks ago. ESRI might have introduced a bug within the MapImage functionality with v3.3 of the API. Look at Derek's initial response to my question. There's a certain way you'll need add the mapImage layer to your map (basically, after the map loads- not during).

View solution in original post

0 Kudos
3 Replies
SteveCole
Honored Contributor
Take a look at this thread I started a couple weeks ago. ESRI might have introduced a bug within the MapImage functionality with v3.3 of the API. Look at Derek's initial response to my question. There's a certain way you'll need add the mapImage layer to your map (basically, after the map loads- not during).
0 Kudos
BenjaminStewart
Deactivated User
Thanks a lot evtguy! That was EXACTLY my problem, and a simple copy and paste solution. It makes sense, I guess, the image can't be referenced until the map has loaded and established its spatialReference.

Now if ESRI could just fix its search options so I had found that thread in the first place this would all be perfect!
0 Kudos
SteveCole
Honored Contributor
Awesome- glad it worked for you! Sometimes it's an easy fix!
0 Kudos