Output Geometry From ArcGISDynamicMapServiceLayer Coordinate System

475
5
11-14-2017 09:20 PM
BehrouzHosseini
Occasional Contributor

Using ArcGIS for JavaScript 3.22 I am overlaying an ArcGISDynamicMapServiceLayer from a ArcGIS Server on top of ESRI basemap. While the service is published in the projected coordinate system with Spatial Reference: 102671 (3435) (NAD_1983_StatePlane_Illinois_East_FIPS_1201_Feet) the eve.mappoint returns the geometry coordinate in the spatial reference of Web Mercator or Geographic (4326) or 102100.

Can you please let me know how I can force the output to be in the Map Service projected format 102671 (3435) ?

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Bengi,

   Because you are using this map service with a esri basemap with means the Map is in WKID 102100, your map service is projected to 102100 by the server before the image is overlayed on the map. Event.mapPoint will always be in 102100 as tha is what the map is operating in. You will have to use GeometryService to project the map point to 102671 if that is what you need.

0 Kudos
BehrouzHosseini
Occasional Contributor

Thanks Robert,

Is using GeometryService involves some setting and configuration on ArcGIS Server/Service side as well? Is there any example of  showing how to achieve this?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bengi,

  No there is nothing you have to do on the server.

require([
  "esri/tasks/ProjectParameters", "esri/tasks/GeometryService" 
], function(ProjectParameters, GeometryService ) {
  var gsvc = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
  var params = new ProjectParameters();
  params.geometries = [evt.mapPoint];
  params.outSR = map.spatialRefrence;
  gsvc.project(params, function(results){
    var pGeom = results[0];
  ]);
  ...
});
BehrouzHosseini
Occasional Contributor

Thanks again but what about the "ArcGISDynamicMapServiceLayer" ? do I have to change it to GeometryService?  Can we run Network Analysis/ Geometric Network on GeometryService?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bengi,

   You should read the JS API docs some more. The GeometryService is a helper class that allows you to work with esri geometries and preform geometry specifc task like project.

GeometryService | API Reference | ArcGIS API for JavaScript 3.22 

Network analysis is a whole other subject and has little to do with GeometryService.

You are not changing your layer class type you are just using the GeometryService to project the mapPoint to the proper WKID.

0 Kudos