Select to view content in your preferred language

arcgis javascript api map spatialreference changes when i add a layer

01-21-2015 02:22 PM
New Contributor III

This one is strange: i have a map that takes features from a gp service and turns them into a graphics layer. If i add the layer, for some reason

the map's spatialreference changes from 4686 to 4326, if i comment that line, the change does not happen. 

The features exposed by the service come in 4686, below is the relevant part, taken from the rest service page:

fragmento sols.png

Even worse, the table where data is stored, was created via arccatalog with wkid 4686. So, i have absolutely no idea where this 4326 is coming from.

<!DOCTYPE html>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>

  <link rel="stylesheet" href="">
  <link rel="stylesheet" href=""> 

  <script type="text/javascript">dojoConfig = {parseOnLoad: true};</script>
  <script src=""></script>

  <script > 
  var mapa;
  var gp;

  function(Map, Extent, Button, Toolbar, parser, Print, FeatureLayer, Geoprocessor, Query, QueryTask) {
  mapa = new Map("map", {
  extent: new esri.geometry.Extent(-82.00, 4.50, -66.00, 14.00, new esri.SpatialReference({ wkid:4686 })),
  zoom: 8, 
  slider: false,
  spatialReference: { wkid: 4686 }

  gp = new esri.tasks.Geoprocessor("...");
  gp.submitJob({}, completeCallback, statusCallback);

  function completeCallback(jobInfo){ 
  gp.getResultData(jobInfo.jobId, "...", function(results, messages) {
  var symbol_ = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, esri.symbol.SimpleLineSymbol.STYLE_SOLID, new esri.Color([255,0,0]) );

  var gl = new esri.layers.GraphicsLayer();

  for (var i = 0; i < results.value.features.length; i++) {
  if (results.value.features.geometry != null) { 
  mapa.addLayer(gl); // <-- THIS IS THE PROBLEMATIC LINE

  function statusCallback(jobInfo) { 


<div id="map"></div>


Thanks a lot.

Tags (1)
0 Kudos
0 Replies