Hi, I currently cannot get the feature layer to load at the moment. Any help is appreciated.
<!DOCTYPE html>
<html>
 <head>
 <meta charset="utf-8" />
 <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
 <title>Intro to MapView - Create a 2D map</title>
 <style>
 html,
 body,
 #viewDiv {
 padding: 0;
 margin: 0;
 height: 100%;
 width: 100%;
 }
 </style>
 <link rel="stylesheet" href="https://js.arcgis.com/4.15/esri/themes/light/main.css" />
 <script src="https://js.arcgis.com/4.15/"></script>
 <script>
 require(["esri/Map", 
 "esri/views/MapView", 
 "esri/layers/FeatureLayer",
 ], function(Map, MapView, FeatureLayer) {
 
 var map = new Map({
 basemap: "streets"
 });
 var view = new MapView({
 container: "viewDiv", // Reference to the scene div created in step 5
 map: map, // Reference to the map object created before the scene
 zoom: 11, // Sets zoom level based on level of detail (LOD)
 center: [282.9, 38.9] // Sets center point of view using longitude,latitude
 });
 
 var publicschoolsLayer = new FeatureLayer({
 url: "https://services1.arcgis.com/MiBZ4u97DWldovjI/arcgis/rest/services/schools_services/FeatureServer/0/query?outFields=*&where=1%3D1"
 });
 
 
 });
 </script>
 </head>
 <body>
 <div id="viewDiv"></div>
 </body>
</html>
Solved! Go to Solution.
Here's my code:
Cody,
Drop the "/query?outFields=*&where=1%3D1" from your url and you will be good to go.
I tried that but it did not work. I believe it could be because I do not have access to it. I thought I set up the server connection correct but I believe I did not at this point.
Hi Cody,
I was able to make it work. Just need to drop the filter as Robert mentioned above and add the Feature layer to the map:
The Schools are located in Florida, your cod is centering the map in a different area:  
 
okay, ill try again, I had it centered differently cause I was looking at different data trying to decide
I still cannot get it to load, I am not sure why. If you were able to load then the rest of the code should be fine.
Here's my code:
It worked now, I was missing a line of code I forgot is needed, thank you
Thank you for the help.
