esriRequest json response to feature layer The Next CEO of Stack OverflowGet ESRI JSON...
Does soap repel water?
How is this set of matrices closed under multiplication?
How many extra stops do monopods offer for tele photographs?
The exact meaning of 'Mom made me a sandwich'
How did people program for Consoles with multiple CPUs?
Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis
What steps are necessary to read a Modern SSD in Medieval Europe?
What is meant by "large scale tonal organization?"
Is the D&D universe the same as the Forgotten Realms universe?
Is it possible to use a NPN BJT as switch, from single power source?
Does Germany produce more waste than the US?
Is it professional to write unrelated content in an almost-empty email?
Won the lottery - how do I keep the money?
Why the difference in type-inference over the as-pattern in two similar function definitions?
Is it possible to replace duplicates of a character with one character using tr
Why does standard notation not preserve intervals (visually)
Bartok - Syncopation (1): Meaning of notes in between Grand Staff
How to get from Geneva Airport to Metabief, Doubs, France by public transport?
Can I use the load factor to estimate the lift?
Make solar eclipses exceedingly rare, but still have new moons
Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?
Why didn't Khan get resurrected in the Genesis Explosion?
How to edit “Name” property in GCI output?
How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?
esriRequest json response to feature layer
The Next CEO of Stack OverflowGet ESRI JSON response locally from Arc document?Javscript API esri/dijit/search JSON ResponseGetting a JSON response with requests and ArcGIS REST APICreating feature layer using local json file in arcgis API for javascript 4?Layer from JSON FileLayer Definition for previous 30 days (JSON)Creating FeatureLayer from JSON data using ArcGIS API for JavaScript 4?ArcObjects: Convert Feature to JSONLeaflet routing machine - get route JSON responseConverting JSON response into a GeoJSON layer in my Leaflet map
I am using JavaScript 4.7 and I am able to retrieve json using esriRequest from our ArcGIS server.
However, I have difficulty in showing this data on the map layer.
the call map.addLayer(featureLayer);
is not working. Here is the code I am using
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Request Test</title>
<link rel="stylesheet" href="http://js.arcgis.com/4.2/esri/css/main.css">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/4.2/dijit/themes/claro/claro.css">
<style>
html, body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
#header {
height: 3%;
overflow: auto;
}
</style>
<script src="http://js.arcgis.com/4.7/"></script>
<script>
require([
"esri/request",
"dojo/on",
"esri/Map",
"esri/layers/FeatureLayer",
"esri/renderers/support/jsonUtils",
"esri/views/MapView",
"esri/symbols/SimpleMarkerSymbol",
"esri/Color", "esri/renderers/SimpleRenderer",
"esri/tasks/support/FeatureSet",
"dojo/domReady!"
], function (
esriRequest,
on,
Map,
FeatureLayer,
rendererJsonUtils, MapView, SimpleMarkerSymbol, Color, SimpleRenderer,
FeatureSet
) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
var input = document.getElementById("inputUrl");
/************************************************
*
* Define the 'options' for our request.
*
*************************************************/
var options = {
query: {
f: 'json'
}
responseType: 'json'
};
// Make the request on a button click using the
// value of the 'input' text.
on(btnQuery, "click", function () {
var url = input.value;
esriRequest(url, options).then(function (response) {
var responseJSON = JSON.stringify(response, null, 2);
var search_layer_result = JSON.parse(responseJSON);
var fs = new FeatureSet(search_layer_result);
var layerDefinition = {
"displayFieldName": "NAME",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 32633
},
"fields": [
{
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "OBJECTID"
},
{
"name": "NAME",
"type": "esriFieldTypeString",
"alias": "NAME",
"length": 50
}
]
};
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: fs
};
var featureLayer = new FeatureLayer(featureCollection);
map.addLayer(featureLayer);
});
});
});
</script>
</head>
<body>
<div class="container">
<div>
<h2>Using esri/request</h2>
<button id="btnQuery">Make Request</button>
<input id="inputUrl" type="text" value="https://arcgisserver/map">
</div>
</div>
<div id="viewDiv">MAP HERE</div>
</body>
</html>
json arcgis-javascript-api-4
bumped to the homepage by Community♦ 30 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using JavaScript 4.7 and I am able to retrieve json using esriRequest from our ArcGIS server.
However, I have difficulty in showing this data on the map layer.
the call map.addLayer(featureLayer);
is not working. Here is the code I am using
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Request Test</title>
<link rel="stylesheet" href="http://js.arcgis.com/4.2/esri/css/main.css">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/4.2/dijit/themes/claro/claro.css">
<style>
html, body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
#header {
height: 3%;
overflow: auto;
}
</style>
<script src="http://js.arcgis.com/4.7/"></script>
<script>
require([
"esri/request",
"dojo/on",
"esri/Map",
"esri/layers/FeatureLayer",
"esri/renderers/support/jsonUtils",
"esri/views/MapView",
"esri/symbols/SimpleMarkerSymbol",
"esri/Color", "esri/renderers/SimpleRenderer",
"esri/tasks/support/FeatureSet",
"dojo/domReady!"
], function (
esriRequest,
on,
Map,
FeatureLayer,
rendererJsonUtils, MapView, SimpleMarkerSymbol, Color, SimpleRenderer,
FeatureSet
) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
var input = document.getElementById("inputUrl");
/************************************************
*
* Define the 'options' for our request.
*
*************************************************/
var options = {
query: {
f: 'json'
}
responseType: 'json'
};
// Make the request on a button click using the
// value of the 'input' text.
on(btnQuery, "click", function () {
var url = input.value;
esriRequest(url, options).then(function (response) {
var responseJSON = JSON.stringify(response, null, 2);
var search_layer_result = JSON.parse(responseJSON);
var fs = new FeatureSet(search_layer_result);
var layerDefinition = {
"displayFieldName": "NAME",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 32633
},
"fields": [
{
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "OBJECTID"
},
{
"name": "NAME",
"type": "esriFieldTypeString",
"alias": "NAME",
"length": 50
}
]
};
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: fs
};
var featureLayer = new FeatureLayer(featureCollection);
map.addLayer(featureLayer);
});
});
});
</script>
</head>
<body>
<div class="container">
<div>
<h2>Using esri/request</h2>
<button id="btnQuery">Make Request</button>
<input id="inputUrl" type="text" value="https://arcgisserver/map">
</div>
</div>
<div id="viewDiv">MAP HERE</div>
</body>
</html>
json arcgis-javascript-api-4
bumped to the homepage by Community♦ 30 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
If you have the URL to the FeatureServer, you can use that to instantiate a FeatureLayer object, e.g.layer = new FeatureLayer({url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"});
Is that what you want? See here for details: developers.arcgis.com/javascript/latest/api-reference/… Oh, and one minor thing: As far as I know there is no such thing as Java 4.7, do you mean ArcGIS API for JavaScript 4.7 by any chance?
– Berend
May 31 '18 at 14:43
One more thing: In version 4.x, the map object does not have a method calledaddLayer()
. You should probably be usingadd()
: developers.arcgis.com/javascript/latest/api-reference/…
– Berend
May 31 '18 at 14:47
add a comment |
I am using JavaScript 4.7 and I am able to retrieve json using esriRequest from our ArcGIS server.
However, I have difficulty in showing this data on the map layer.
the call map.addLayer(featureLayer);
is not working. Here is the code I am using
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Request Test</title>
<link rel="stylesheet" href="http://js.arcgis.com/4.2/esri/css/main.css">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/4.2/dijit/themes/claro/claro.css">
<style>
html, body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
#header {
height: 3%;
overflow: auto;
}
</style>
<script src="http://js.arcgis.com/4.7/"></script>
<script>
require([
"esri/request",
"dojo/on",
"esri/Map",
"esri/layers/FeatureLayer",
"esri/renderers/support/jsonUtils",
"esri/views/MapView",
"esri/symbols/SimpleMarkerSymbol",
"esri/Color", "esri/renderers/SimpleRenderer",
"esri/tasks/support/FeatureSet",
"dojo/domReady!"
], function (
esriRequest,
on,
Map,
FeatureLayer,
rendererJsonUtils, MapView, SimpleMarkerSymbol, Color, SimpleRenderer,
FeatureSet
) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
var input = document.getElementById("inputUrl");
/************************************************
*
* Define the 'options' for our request.
*
*************************************************/
var options = {
query: {
f: 'json'
}
responseType: 'json'
};
// Make the request on a button click using the
// value of the 'input' text.
on(btnQuery, "click", function () {
var url = input.value;
esriRequest(url, options).then(function (response) {
var responseJSON = JSON.stringify(response, null, 2);
var search_layer_result = JSON.parse(responseJSON);
var fs = new FeatureSet(search_layer_result);
var layerDefinition = {
"displayFieldName": "NAME",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 32633
},
"fields": [
{
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "OBJECTID"
},
{
"name": "NAME",
"type": "esriFieldTypeString",
"alias": "NAME",
"length": 50
}
]
};
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: fs
};
var featureLayer = new FeatureLayer(featureCollection);
map.addLayer(featureLayer);
});
});
});
</script>
</head>
<body>
<div class="container">
<div>
<h2>Using esri/request</h2>
<button id="btnQuery">Make Request</button>
<input id="inputUrl" type="text" value="https://arcgisserver/map">
</div>
</div>
<div id="viewDiv">MAP HERE</div>
</body>
</html>
json arcgis-javascript-api-4
I am using JavaScript 4.7 and I am able to retrieve json using esriRequest from our ArcGIS server.
However, I have difficulty in showing this data on the map layer.
the call map.addLayer(featureLayer);
is not working. Here is the code I am using
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Request Test</title>
<link rel="stylesheet" href="http://js.arcgis.com/4.2/esri/css/main.css">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/4.2/dijit/themes/claro/claro.css">
<style>
html, body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
#header {
height: 3%;
overflow: auto;
}
</style>
<script src="http://js.arcgis.com/4.7/"></script>
<script>
require([
"esri/request",
"dojo/on",
"esri/Map",
"esri/layers/FeatureLayer",
"esri/renderers/support/jsonUtils",
"esri/views/MapView",
"esri/symbols/SimpleMarkerSymbol",
"esri/Color", "esri/renderers/SimpleRenderer",
"esri/tasks/support/FeatureSet",
"dojo/domReady!"
], function (
esriRequest,
on,
Map,
FeatureLayer,
rendererJsonUtils, MapView, SimpleMarkerSymbol, Color, SimpleRenderer,
FeatureSet
) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
var input = document.getElementById("inputUrl");
/************************************************
*
* Define the 'options' for our request.
*
*************************************************/
var options = {
query: {
f: 'json'
}
responseType: 'json'
};
// Make the request on a button click using the
// value of the 'input' text.
on(btnQuery, "click", function () {
var url = input.value;
esriRequest(url, options).then(function (response) {
var responseJSON = JSON.stringify(response, null, 2);
var search_layer_result = JSON.parse(responseJSON);
var fs = new FeatureSet(search_layer_result);
var layerDefinition = {
"displayFieldName": "NAME",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 32633
},
"fields": [
{
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "OBJECTID"
},
{
"name": "NAME",
"type": "esriFieldTypeString",
"alias": "NAME",
"length": 50
}
]
};
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: fs
};
var featureLayer = new FeatureLayer(featureCollection);
map.addLayer(featureLayer);
});
});
});
</script>
</head>
<body>
<div class="container">
<div>
<h2>Using esri/request</h2>
<button id="btnQuery">Make Request</button>
<input id="inputUrl" type="text" value="https://arcgisserver/map">
</div>
</div>
<div id="viewDiv">MAP HERE</div>
</body>
</html>
json arcgis-javascript-api-4
json arcgis-javascript-api-4
edited May 31 '18 at 15:09
Ian Turton♦
50k548116
50k548116
asked May 31 '18 at 14:27
ThomasThomas
161
161
bumped to the homepage by Community♦ 30 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 30 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
If you have the URL to the FeatureServer, you can use that to instantiate a FeatureLayer object, e.g.layer = new FeatureLayer({url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"});
Is that what you want? See here for details: developers.arcgis.com/javascript/latest/api-reference/… Oh, and one minor thing: As far as I know there is no such thing as Java 4.7, do you mean ArcGIS API for JavaScript 4.7 by any chance?
– Berend
May 31 '18 at 14:43
One more thing: In version 4.x, the map object does not have a method calledaddLayer()
. You should probably be usingadd()
: developers.arcgis.com/javascript/latest/api-reference/…
– Berend
May 31 '18 at 14:47
add a comment |
If you have the URL to the FeatureServer, you can use that to instantiate a FeatureLayer object, e.g.layer = new FeatureLayer({url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"});
Is that what you want? See here for details: developers.arcgis.com/javascript/latest/api-reference/… Oh, and one minor thing: As far as I know there is no such thing as Java 4.7, do you mean ArcGIS API for JavaScript 4.7 by any chance?
– Berend
May 31 '18 at 14:43
One more thing: In version 4.x, the map object does not have a method calledaddLayer()
. You should probably be usingadd()
: developers.arcgis.com/javascript/latest/api-reference/…
– Berend
May 31 '18 at 14:47
If you have the URL to the FeatureServer, you can use that to instantiate a FeatureLayer object, e.g.
layer = new FeatureLayer({url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"});
Is that what you want? See here for details: developers.arcgis.com/javascript/latest/api-reference/… Oh, and one minor thing: As far as I know there is no such thing as Java 4.7, do you mean ArcGIS API for JavaScript 4.7 by any chance?– Berend
May 31 '18 at 14:43
If you have the URL to the FeatureServer, you can use that to instantiate a FeatureLayer object, e.g.
layer = new FeatureLayer({url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"});
Is that what you want? See here for details: developers.arcgis.com/javascript/latest/api-reference/… Oh, and one minor thing: As far as I know there is no such thing as Java 4.7, do you mean ArcGIS API for JavaScript 4.7 by any chance?– Berend
May 31 '18 at 14:43
One more thing: In version 4.x, the map object does not have a method called
addLayer()
. You should probably be using add()
: developers.arcgis.com/javascript/latest/api-reference/…– Berend
May 31 '18 at 14:47
One more thing: In version 4.x, the map object does not have a method called
addLayer()
. You should probably be using add()
: developers.arcgis.com/javascript/latest/api-reference/…– Berend
May 31 '18 at 14:47
add a comment |
1 Answer
1
active
oldest
votes
According to the documentation :
FeatureLayers may be created in one of three ways: from a service URL, an ArcGIS portal item ID, or from an array of client-side graphics
So in your case, you would use the third option :
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source
By looking at your layerDefinition, your esriRequest should return two values : OBJECTID and NAME
Now use them to populate the attributes of your graphics :
var features = [
{
geometry: {
type: "point",
x: -100,
y: 38
},
attributes: {
ObjectID: objectid,
name: name
}
},
...
];
var featureLayer = new FeatureLayer({
source: features
});
And as Berend
said, in ArcGIS Javascript version 4, you should be using :
map.add(featureLayer);
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f284792%2fesrirequest-json-response-to-feature-layer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to the documentation :
FeatureLayers may be created in one of three ways: from a service URL, an ArcGIS portal item ID, or from an array of client-side graphics
So in your case, you would use the third option :
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source
By looking at your layerDefinition, your esriRequest should return two values : OBJECTID and NAME
Now use them to populate the attributes of your graphics :
var features = [
{
geometry: {
type: "point",
x: -100,
y: 38
},
attributes: {
ObjectID: objectid,
name: name
}
},
...
];
var featureLayer = new FeatureLayer({
source: features
});
And as Berend
said, in ArcGIS Javascript version 4, you should be using :
map.add(featureLayer);
add a comment |
According to the documentation :
FeatureLayers may be created in one of three ways: from a service URL, an ArcGIS portal item ID, or from an array of client-side graphics
So in your case, you would use the third option :
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source
By looking at your layerDefinition, your esriRequest should return two values : OBJECTID and NAME
Now use them to populate the attributes of your graphics :
var features = [
{
geometry: {
type: "point",
x: -100,
y: 38
},
attributes: {
ObjectID: objectid,
name: name
}
},
...
];
var featureLayer = new FeatureLayer({
source: features
});
And as Berend
said, in ArcGIS Javascript version 4, you should be using :
map.add(featureLayer);
add a comment |
According to the documentation :
FeatureLayers may be created in one of three ways: from a service URL, an ArcGIS portal item ID, or from an array of client-side graphics
So in your case, you would use the third option :
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source
By looking at your layerDefinition, your esriRequest should return two values : OBJECTID and NAME
Now use them to populate the attributes of your graphics :
var features = [
{
geometry: {
type: "point",
x: -100,
y: 38
},
attributes: {
ObjectID: objectid,
name: name
}
},
...
];
var featureLayer = new FeatureLayer({
source: features
});
And as Berend
said, in ArcGIS Javascript version 4, you should be using :
map.add(featureLayer);
According to the documentation :
FeatureLayers may be created in one of three ways: from a service URL, an ArcGIS portal item ID, or from an array of client-side graphics
So in your case, you would use the third option :
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#source
By looking at your layerDefinition, your esriRequest should return two values : OBJECTID and NAME
Now use them to populate the attributes of your graphics :
var features = [
{
geometry: {
type: "point",
x: -100,
y: 38
},
attributes: {
ObjectID: objectid,
name: name
}
},
...
];
var featureLayer = new FeatureLayer({
source: features
});
And as Berend
said, in ArcGIS Javascript version 4, you should be using :
map.add(featureLayer);
answered May 31 '18 at 16:43
LMokraneLMokrane
407210
407210
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f284792%2fesrirequest-json-response-to-feature-layer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you have the URL to the FeatureServer, you can use that to instantiate a FeatureLayer object, e.g.
layer = new FeatureLayer({url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0"});
Is that what you want? See here for details: developers.arcgis.com/javascript/latest/api-reference/… Oh, and one minor thing: As far as I know there is no such thing as Java 4.7, do you mean ArcGIS API for JavaScript 4.7 by any chance?– Berend
May 31 '18 at 14:43
One more thing: In version 4.x, the map object does not have a method called
addLayer()
. You should probably be usingadd()
: developers.arcgis.com/javascript/latest/api-reference/…– Berend
May 31 '18 at 14:47