<script> require([ "dojo/ready", "dojo/parser", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/map", "esri/dijit/LocateButton", "esri/config", "esri/tasks/GeometryService", "esri/urlUtils", "esri/arcgis/utils", "dojo/dom", "dojo/_base/array", "esri/dijit/editing/Editor", "dojo/domReady!" ], function( ready, parser, BorderContainer, ContentPane, Map, LocateButton, config, GeometryService, urlUtils, arcgisUtils, dom, array, Editor ) { ready(function(){ parser.parse(); config.defaults.io.proxyUrl = "/proxy"; config.defaults.geometryService = new GeometryService("http://maps.ci.perrysburg.oh.us/arcgis/rest/services/Utilities/Geometry/GeometryServer"); //check to see if a webmap was specified using URL params. If not use the //hardcoded webmap id var urlObject = urlUtils.urlToObject(document.location.href); var webmap = "90d7e213fb014d31ac623d233511fcf9"; if(urlObject.query && urlObject.query.webmap){ webmap = urlObject.query.webmap; } //create the map arcgisUtils.createMap(webmap, "map", { mapOptions: { sliderStyle: "large" }, ignorePopups: true }).then(function(response){ var map = response.map; dom.byId("title").innerHTML = response.itemInfo.item.title; dom.byId("snippet").innerHTML = response.itemInfo.item.snippet; geoLocate = new LocateButton({ map: map, geolocationOptions: { maximumAge: 0, timeout: 15000, enableHighAccuracy: true } }, "LocateButton"); //create the editor widget var layerInfo = []; var layers = response.itemInfo.itemData.operationalLayers; array.forEach(layers, function (layer){ layerInfo.push({ "featureLayer": layer.layerObject }); }); var settings = { map: map, layerInfos: layerInfo }; var editorWidget = new Editor({ settings: settings },"editorDiv"); editorWidget.startup(); }); }); }); </script>
Solved! Go to Solution.
geoLocate = new LocateButton({ map: map, geolocationOptions: { maximumAge: 0, timeout: 15000, enableHighAccuracy: true } }, "LocateButton"); geoLocate.startup();
var geoLocate = new LocateButton({
var userLocation = new LocateButton({ map: mainMap }, "userLocDIV"); userLocation.startup();
Thanks I just figured it out. It was a projection issue.
Watching the traffic I saw this:
Map: Geometry (wkid: 102100) cannot be converted to spatial reference of the map (wkid: 102722)
I'm using a basemap that I published on ArcGIS Online which has a State Plane Ohio North projection. I changed it to an ArcGIS Onilne basemap with a Web Mercator projection and everything worked fine.
Does anybody know how I would be able to use a non Web Mercator projection with the Locate Widget?
Thanks
Thanks I just figured it out. It was a projection issue.
Watching the traffic I saw this:
Map: Geometry (wkid: 102100) cannot be converted to spatial reference of the map (wkid: 102722)
I'm using a basemap that I published on ArcGIS Online which has a State Plane Ohio North projection. I changed it to an ArcGIS Onilne basemap with a Web Mercator projection and everything worked fine.
Does anybody know how I would be able to use a non Web Mercator projection with the Locate Widget?
Thanks
d._canProject(c)?d.isWebMercator()?b=O.geographicToWebMercator(b):4326===d.wkid&&(b=O.webMercatorToGeographic(b,!0)):(console.log("Map: "+v.substitute({geometry:c.wkid||c.wkt,map:d.wkid||d.wkt},this.invalidGeometry)),b=null))