public-information-map-template-js icon indicating copy to clipboard operation
public-information-map-template-js copied to clipboard

Share extent issue when basemap is other than WebMeractor or WGS84 (4326)

Open sverkerEsriSE opened this issue 6 years ago • 1 comments

When this template is used with a web map that has a basemap with another coordinate system than Web Mercator (EPSG:3857) or WGS84 (EPSG:4326), a javascript error will appear stating that "Cannot read property xmin of undefined".

From what I can tell, the reason for this is the code on line 254 in the file js/ShareDialog.js where it tries to get the map.geographicExtent, which according to the API is only available for maps with WebMercator or WGS84 spatial reference: https://developers.arcgis.com/javascript/3/jsapi/map-amd.html#geographicextent

sverkerEsriSE avatar Mar 09 '18 10:03 sverkerEsriSE

Map Tools solves this by projection the extent: https://github.com/Esri/map-tools-template/blob/aec5f2086f025fa2a51a405a7662c5d0140008ef/js/ShareDialog.js#L278

sverkerEsriSE avatar Mar 15 '18 09:03 sverkerEsriSE