AnsweredAssumed Answered

Can I render a markerSymbol image without having to define the width and height manually?

Question asked by laddieboy on May 2, 2019
Latest reply on May 3, 2019 by laddieboy

Here is the function we currently use to add the point images onto our map:

 

function addGraphic() {
var point = new Point();
point.setLongitude(document.getElementById("lon").value);
point.setLatitude(document.getElementById("lat").value);

var infoTemplate = new InfoTemplate();
infoTemplate.setTitle("Population");
infoTemplate.setContent("Hi<br/>Dude!");

var markerSymbol = new PictureMarkerSymbol();
markerSymbol.setUrl(document.getElementById("picture_url").value);
//markerSymbol.setHeight(64);
//markerSymbol.setWidth(64);

map.enableMapNavigation();
var graphic = new Graphic(point, markerSymbol);
graphic.setInfoTemplate(infoTemplate);
map.graphics.add(graphic);
}

 

You will notice that we commented out the setHeight and setWidth lines in hopes that it would simply render the actual image in its actual height and width.

 

We have a Google Maps application we are migrating to ESRI.  In our application, we have a zillion little picture files that can be markerSymbol images on the map.  The heights and widths of these images are different from one another.  When I have ESRI render our images onto the map, it distorts them all into a one size fits all square.

 

Is there a way to make ESRI simply display an image on the map (whatever the zoom level) without distorting that image or must I manually set the width and height of each image (which is going to be a huge job to figure out the height and width of the zillions of images we have and store them in a database somewhere to have to manually set them in ESRI)?

Outcomes