ESRI Graphic point not getting plotted for basemap with spatial reference 32640 — Javascript API 4.16

08-29-2020 02:44 AM
New Contributor

I have a basemap with spatial reference wkid 32640, I'm trying to load the basemap which is hosted on our GIS portal using the portal ID as shown in the following code.

I have a normal coordinate taken from google map, which I need to plot on the above mentioned ESRI map.

I have tried to project the google map point to 32640 projection, I was able to project the point but the point / graphic is not getting added/displayed in the map.

Can anyone please check this?

require(["esri/Map","esri/views/MapView","esri/WebMap","esri/widgets/BasemapToggle","esri/widgets/Expand","esri/widgets/Locate","esri/widgets/Search","esri/Graphic","esri/layers/GraphicsLayer","esri/widgets/Search/SearchSource","esri/request","esri/tasks/GeometryService","esri/geometry/Point","esri/widgets/BasemapGallery","esri/config","esri/views/SceneView","esri/WebScene","esri/geometry/projection","esri/geometry/SpatialReference","esri/geometry/support/webMercatorUtils"], function (Map, MapView, WebMap, BasemapToggle, Expand, Locate, Search, Graphic,                                             GraphicsLayer, SearchSource, esriRequest, GeometryService,                                             Point, BasemapGallery, esriConfig, SceneView, WebScene,                                                     projection,SpatialReference,webMercatorUtils) { esriConfig.portalUrl = "https://server.domain.countrycode/gisportal"var webmap = new WebMap({  portalItem: {    id: "fe56448250a*********4637bdbbb1a"  }});var outSpatialReference = new SpatialReference({wkid: 32640})var view = new MapView({  container: "viewDiv",  map: webmap,  zoom:7,  spatialReference:outSpatialReference});var point = {  type: "point",  x: 54.4125,  y: 24.4345,  spatialReference:new SpatialReference({wkid: 4326})}; var simpleMarkerSymbol = {  type: "simple-marker",  color: [226, 119, 40],  outline: {    color: [255, 255, 255],    width: 1  }};var graphicsLayer = new GraphicsLayer();map.add(graphicsLayer); projection.load().then(function () {  var projectedGeometries = projection.project(point, outSpatialReference);  console.log(projectedGeometries.x, projectedGeometries.y);   var pointGraphic = new Graphic({    geometry: projectedGeometries,    symbol: simpleMarkerSymbol   });   graphicsLayer.add(pointGraphic);});});
0 Kudos
0 Replies