FeatureLayer not showing in 4.9 vs. 4.8

955
4
10-30-2018 04:02 PM
LoriEmerson_McCormack
Occasional Contributor

When I use 4.9, the feature layer doesn't display on the map.  When I use 4.8, it does display. One possible problem may be that the spatial references are different between the basemap and my feature layer.  My layer in the map service has two unique values for its symbology, so I tried using a single symbol renderer in the code instead.

My goal is to edit the feature layer. 

require([

"esri/Map",

"esri/views/MapView",

"esri/layers/FeatureLayer",

"esri/Graphic",

//"esri/widgets/Expand",

//"esri/widgets/FeatureForm",

"esri/geometry/Extent",

"esri/geometry/SpatialReference"

],

function(

Map, MapView, FeatureLayer, Graphic,

//Expand, FeatureForm,

Extent, SpatialReference

) {

let editFeature, highlight, featureForm, editArea, attributeEditing, updateInstructionDiv;

var initialExtent = new Extent(

-117.83, 47.23,

-117.03, 48.055,

SpatialReference({ wkid: 4326 })

);

 

var citiesRenderer = {

type: "simple", // autocasts as new SimpleRenderer()

symbol: {

type: "simple-marker", // autocasts as new SimpleMarkerSymbol()

size: 10,

color: "#FF4000",

outline: { // autocasts as new SimpleLineSymbol()

color: [255, 64, 0, 0.4], // autocasts as new Color()

width: 7

}

}

};

const layerWorksite = new FeatureLayer({

//url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services/IncidentsReport/FeatureServer/0",

url: "http://igis.spokanecounty.org/arcgis/rest/services/PublicWorks/CommuteTripReductionDev/MapServer/0",

renderer: citiesRenderer

});

const map = new Map({

basemap: "topo",

layers: [layerWorksite]

});

const view = new MapView({

container: "viewDiv",

map: map,

extent: initialExtent

//center: [-117.4123, 47.65726],

//zoom: 12

});

});

0 Kudos
4 Replies
KellyHutchins
Esri Frequent Contributor

I can't access your service but the code does work with the commented out Incidents feature service. If you run your app are there any errors in the developer console? 

0 Kudos
LoriEmerson_McCormack
Occasional Contributor

There are 4 errors in the developer console relating to the layer in my map service.  What is unique about this layer is that it is an XY Event based on a SQL Server view.

developer console error messages

Ultimately, I would like to use a feature class instead where the user can click on the map to add a new point feature.  When I submitted the first question on October 30th, I was using a point feature class with a State Plane projection. 

Today, however, I am using an XY Event layer in the map service and using SQL Server stored procedure to insert a record into the SQL Server table with X,Y coordinates that the API captures when the user clicks on the map.  I defined the spatial reference for my XY Event layer to be the same as the ESRI basemap. 

0 Kudos
KellyHutchins
Esri Frequent Contributor

Can you access the service url via a browser? http://igis.spokanecounty.org/arcgis/rest/services/PublicWorks/CommuteTripReductionDev/MapServer/0 

You mentioned that this used to work at 4.8? If I try the your code at 4.8 it isn't working for me.  Perhaps something has changed with the permissions of the service? 

0 Kudos
LoriEmerson_McCormack
Occasional Contributor

It is working for me in 4.8.  See the map and the developer console messages.

ArcGIS API Sample using 4.8 and my feature layer -- mapArcGIS API Sample using 4.8 and my feature layer -- developer console messages

0 Kudos