Hello,
I am trying to implement the following rest endpoint data:
http://arcgis-central.gis.vt.edu/arcgis/rest/services/vtcampusmap/ParkingSpaces/MapServer
Onto my basemap. I would like to do this through ArcGIS java script. I thought that I was following all the steps correctly that I found on Feature Layer (basic) | ArcGIS API for JavaScript , but it does not want to show up.
I am thinking it could be a problem with the type of layer that I am calling it? For example, it may need to be ArcGISgraphiclayer instead of FeatureLayer or something like that.
Maybe it is something entirely different, but I can't understand why it is not working.
My code is attached.
Solved! Go to Solution.
Eric,
You had a couple of issue in your code:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="http://js.arcgis.com/3.16/esri/css/esri.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.16/dijit/themes/claro/claro.css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <script src="http://js.arcgis.com/3.16/"></script> <title></title> <style> html, body, #mapDiv { padding: 0; margin: 0; height: 100%; } </style> <script> require(["esri/map", "esri/layers/FeatureLayer", "dojo/domReady!"], function(Map, FeatureLayer) { var map = new Map("mapDiv", { center: [-80.4178, 37.23], zoom: 19, basemap: "streets" }); var featureLayer = new FeatureLayer("http://arcgis-central.gis.vt.edu/arcgis/rest/services/vtcampusmap/ParkingSpaces/MapServer/0"); map.addLayer(featureLayer); }); </script> </head> <body class="claro"> <div id="mapDiv"></div> </body> </html>
Eric,
You had a couple of issue in your code:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="http://js.arcgis.com/3.16/esri/css/esri.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.16/dijit/themes/claro/claro.css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <script src="http://js.arcgis.com/3.16/"></script> <title></title> <style> html, body, #mapDiv { padding: 0; margin: 0; height: 100%; } </style> <script> require(["esri/map", "esri/layers/FeatureLayer", "dojo/domReady!"], function(Map, FeatureLayer) { var map = new Map("mapDiv", { center: [-80.4178, 37.23], zoom: 19, basemap: "streets" }); var featureLayer = new FeatureLayer("http://arcgis-central.gis.vt.edu/arcgis/rest/services/vtcampusmap/ParkingSpaces/MapServer/0"); map.addLayer(featureLayer); }); </script> </head> <body class="claro"> <div id="mapDiv"></div> </body> </html>
Thank you!
This was extremely helpful. Yes point three was definitely the most critical.
Yes the zoom was set out as far as it was becuase we are going to change the extents on the feature layer to accommodate a smaller zoom level.
Much appreciated,
Eric Bianchi
Eric,
When a reply has answered your question you should click on the "correct answer" link on that reply to close the question.
Thank you,
Does AND do anything, or is it always "OR"?
Eric
On Sun, Apr 10, 2016 at 4:47 PM, Robert Scheitlin, GISP <geonet@esri.com>
Eric, I am guessing your AND vs OR question is directed at your other thread here:
Feature Layer multiple definition expressions
Robert has addressed that question.
For logic questions involving AND as well as OR (and others), you have to think like a computer.
"AND" works if BOTH of your conditions are true.
"OR" works if EITHER of your conditions are true.
For the OR statement
Type = red | Type = blue | True? |
---|---|---|
Yes | No | Yes |
No | Yes | Yes |
Yes | Yes | Yes |
No | No | No |
For the AND statement
Type = red | Type = blue | True? |
---|---|---|
Yes | No | No |
No | Yes | No |
No | No | No |
Yes | Yes | Yes |
Hopefully that makes sense.