Hi all,I have a State Plane-based map to which I'd like to add a point (WGS84) for the user's location. This is my code:if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(location) { gpsPoint.setLatitude(location.coords.latitude); gpsPoint.setLongitude(location.coords.longitude); gpsGraphic.setGeometry(gpsPoint); gpsGraphic.setSymbol(gpsSymbol); map.graphics.add(gpsGraphic); map.centerAndZoom(gpsPoint, 12); gpsIsOn = true; }); }
So far I'm getting the error:Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 2229)
Specifically it's the centerAndZoom call that is throwing the error. I found this post which suggested using a geometry service to reproject the point:// Project gpsPoint to State Plane var projectParams = new esri.tasks.ProjectParameters(); projectParams.geometries = [gpsPoint]; projectParams.outSR = map.spatialReference; var defer = geometryService.project(projectParams); dojo.when( defer, function(projectedGeometry) { if (projectedGeometry.length > 0) { gpsPoint = projectedGeometry[0]; } });
But that gives the error:Uncaught TypeError: Cannot read property 'query' of undefined No idea where that's coming from! I've checked the projectParams object and both the geometry and outSR look fine. Can anyone tell what I'm doing wrong here, or what a better method might be?Many thanks