I have a png image that we host that I need to resize and overlay onto a map at specific gps coordinates. Would this be an image class? I can't seem to find any examples that match up with my needs. I can find lots of examples of ArcGIS service layer examples but I don't think this is what I'm looking for. Any ideas?
EDIT
I found that what I want to do is in the MapImageLayer class.
This version works but its in the old 2.5 version
<script>var dojoConfig = { parseOnLoad: true };</script>
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script>
<script>
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.layers.MapImageLayer");
var map;
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-9005991,"ymin":3866418,"xmax":-8620442,"ymax":4022043});
map = new esri.Map("map",{extent:initExtent});
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);
// create and add the layer
var mil = new esri.layers.MapImageLayer({
//'id': 'usgs_screen_overlay'
});
map.addLayer(mil);
// create an add the actual image
var mi = new esri.layers.MapImage({
'extent': { 'xmin': -8864908, 'ymin': 3885443, 'xmax': -8762763, 'ymax': 3976997},
'href': 'http://il.water.usgs.gov/_ags60fb0c9554ef42a58e7024d8464a2ecb.png'
});
mil.addImage(mi);
dojo.connect(map, 'onLoad', function() {
dojo.connect(dijit.byId('map'), 'resize', map, map.resize);
});
}
dojo.ready(init);
</script>
This version does not work but its the newer 3.7 version (the one I'd like to work)
<script src="http://js.arcgis.com/3.7/"></script>
<script>
require([
"esri/map",
"esri/layers/MapImageLayer",
"esri/layers/MapImage"
], function(
Map, MapImageLayer, MapImage
) {
var map = new Map("mapDiv", {
center: [-56.049, 38.485],
zoom: 3,
basemap: "streets"
});
map.on("load", function() {
// create and add the layer
var mil = new MapImageLayer();
map.addLayer(mil);
// create an add the actual image
var mi = new MapImage({
'extent': { 'xmin': -8864908, 'ymin': 3885443, 'xmax': -8762763, 'ymax': 3976997},
'href': 'http://il.water.usgs.gov/_ags60fb0c9554ef42a58e7024d8464a2ecb.png'
});
mil.addImage(mi);
});
});
I just can't seem to find what I'm missing or have wrong.
Best Answer
esri.layers.I finally got it right! I guess my gps coordinates were off.
Here is the working code.
There were zero examples of this online so hopefully someone else who is working with this class finds this useful.