Currently, I am utilizing Esri GIS to load the center location from an address. However, I am encountering an issue as I am using a geocoder from Google to obtain longitude and latitude, which is resulting in the following error message:
TypeError: this.spatialReference is undefined
Would you happen to have any insights or suggestions on how to resolve this problem? Below is my code snippet for reference:
require(["esri/map", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/PictureMarkerSymbol", "esri/graphic", "esri/layers/GraphicsLayer", "dojo/domReady!" ],
function(Map, Point, SimpleMarkerSymbol, PictureMarkerSymbol, Graphic, GraphicsLayer) {
var point = new Point(0, 0, new esri.SpatialReference({ wkid: gisMap['wkid'] }));
map = new Map(mapHolder, {center: point,zoom: gisMap['zoomlevel']});
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': keyword }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
console.log(longitude + "|" + latitude);
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
map.centerAt(new Point(longitude,latitude));
console.log(map);
} else {
console.log("No results found");
}
} else {
console.log("Something went wrong: " + status);
}
});
});