Esri / public-information-map-template-js

An ArcGIS Online mapping template to showcase social media on a map for disaster response and public information.
http://esri.github.io/public-information-map-template-js/
Apache License 2.0
69 stars 51 forks source link

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

Open sverkerEsriSE opened 6 years ago

sverkerEsriSE commented 6 years ago

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 commented 6 years ago

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