POST
|
Thanks Robert, I still seem to have the issue. Im a bit new to this. My changes are below: var query = new Query(); query.where = "LINE ='BMT'"; query.outFields = [ "*" ]; query.outSpatialReference = view.spatialReference; *******Added this line. query.returnGeometry = true; var queryTask = new QueryTask({ url:"https://services1.arcgis.com/JPUKRee8mEBfJ0K4/arcgis/rest/services/Subway/FeatureServer" });
... View more
04-26-2019
12:21 PM
|
0
|
2
|
1115
|
POST
|
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> <title>Intro to FeatureLayer - 4.11</title> <link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css" /> <script src="https://js.arcgis.com/4.11/"></script> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } </style> <script> require([ "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/tasks/support/Query", "esri/tasks/QueryTask", "esri/Graphic" ], function(Map, MapView, FeatureLayer, Query,QueryTask,Graphic) { var map = new Map({ basemap: "topo" }); var view = new MapView({ container: "viewDiv", map: map, center: [-73.98,40.74], zoom: 13 }); /******************** * Add feature layer ********************/ // var featureLayer = new FeatureLayer({ // url: // "https://services1.arcgis.com/JPUKRee8mEBfJ0K4/arcgis/rest/services/Subway/FeatureServer" // }); //map.add(featureLayer); var query = new Query(); query.where = "LINE ='BMT'"; query.outFields = [ "*" ]; query.returnGeometry = true; var queryTask = new QueryTask({ url:"https://services1.arcgis.com/JPUKRee8mEBfJ0K4/arcgis/rest/services/Subway/FeatureServer" }); queryTask.execute(query) .then(function(result){ //console.log(result.features.length) //*** ADD ***// result.features.forEach(function(item){ var g = new Graphic({ geometry: item.geometry, attributes: item.attributes, symbol: { type: "simple-marker", color: "black", width: 1.2, style: "short-dot" } }); view.graphics.add(g); }); }); }); </script> </head> <body> <div id="viewDiv"></div> </body> </html>
... View more
04-26-2019
11:22 AM
|
0
|
4
|
1185
|
POST
|
So whenever I click the buttons below in the webpage, it doesn't seem to remove the highlighted features properly from my map. Could anyone see the reason why none of the highlighted features are not removed properly? See code below: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> <title>Intro to PopupTemplate - 4.10</title> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } #paneDiv { position: absolute; bottom: 0; width: 100%; padding: 20px 0; z-index: 1; text-align: center; } button { background: white; padding: 7px; border: 1px solid #005e95; font-size: 0.9em; margin: 5px; color: #005e95; } </style> <link rel="stylesheet" href="https://js.arcgis.com/4.10/esri/css/main.css"> <script src="https://js.arcgis.com/4.10/"></script> <script> require([ "esri/Map", "esri/layers/FeatureLayer", "esri/views/MapView" ], function( Map, FeatureLayer, MapView ) { // // const fLayer = new featureLayer({ // portalItem: { // id: "bba798b019ce4f20ac7db2b1f5df860c#data" // } // }); var template = { // autocasts as new PopupTemplate() title: "This Lot is {Lot} SQFT in Size", content: [{ // It is also possible to set the fieldInfos outside of the content // directly in the popupTemplate. If no fieldInfos is specifically set // in the content, it defaults to whatever may be set within the popupTemplate. type: "fields", fieldInfos: [{ fieldName: "Borough", label: "Borough", visible: true }, { fieldName: "Block", label: "Block", visible: true, format: { digitSeparator: true, places: 0 } }] }] }; var featureLayer = new FeatureLayer({ portalItem: { id:"bba798b019ce4f20ac7db2b1f5df860c" }, popupTemplate: template }); // Create the map var map = new Map({ basemap: "gray", layers: [featureLayer] }); // Create the MapView var view = new MapView({ container: "viewDiv", map: map, center: [-73.954509, 40.620479], zoom: 13 }); /************************************************************* * The PopupTemplate content is the text that appears inside the * popup. {fieldName} can be used to reference the value of an * attribute of the selected feature. HTML elements can be used * to provide structure and styles within the content. The * fieldInfos property is an array of objects (each object representing * a field) that is use to format number fields and customize field * aliases in the popup and legend. **************************************************************/ // Reference the popupTemplate instance in the // popupTemplate property of FeatureLayer // //map.add(featureLayer); var highlightSelect; //var hoverPromise; view.when(function(){ var lotLayer = map.layers.getItemAt(0); view.whenLayerView(lotLayer).then(function(layerView){ var queryLots = lotLayer.createQuery(); var buttons = document.querySelectorAll("button"); for (var i = 0, button = null; button = buttons; i++){ console.log(button); button.addEventListener("click", onClick); } function onClick(event){ queryLots.where = "Lot='" + event.target.innerText + "'"; lotLayer.queryFeatures(queryLots).then( function(result){ //var x = null; if (highlightSelect){ highlightSelect.remove(); } for(x = 0; x < result.features.length; x++){ var feature = result.features ; //console.log(feature); highlightSelect = layerView.highlight(feature.attributes['OBJECTID']); //console.log(highlightSelect); //return x; } }); } }); }) }); </script> </head> <body> <div id="viewDiv"></div> <div id="paneDiv"> <h3> Click to polygons with these SQFT </h3> <button>1</button> <button>18</button> <button>67</button> </div> </body> </html>
... View more
03-29-2019
01:07 PM
|
0
|
2
|
3230
|
POST
|
Below is my code that I have been tinkering with, however, I can't seem to figure how to remove highlighting from my 3D buildings. Not sure how to go about it. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> <title>Intro to SceneLayer - 4.10</title> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } </style> <link rel="stylesheet" href="https://js.arcgis.com/4.10/esri/css/main.css"> <script src="https://js.arcgis.com/4.10/"></script> <script> require([ "esri/Map", "esri/views/SceneView", "esri/layers/SceneLayer" ], function(Map, SceneView, SceneLayer) { // Create Map var map = new Map({ basemap: "dark-gray", ground: "world-elevation" }); // Create the SceneView var view = new SceneView({ container: "viewDiv", map: map, camera: { position: [-80.196073,25.792461, 707], tilt: 81, heading: 50 } }); // Create SceneLayer and add to the map var sceneLayer = new SceneLayer({ portalItem: { id: "b162d491955744ff9e9de7913bb49693 " }, popupEnabled: false }); map.add(sceneLayer); // Create MeshSymbol3D for symbolizing SceneLayer var symbol = { type: "mesh-3d", // autocasts as new MeshSymbol3D() symbolLayers: [{ type: "fill", // autocasts as new FillSymbol3DLayer() // If the value of material is not assigned, the default color will be grey material: { color: [244, 247, 134] } }] }; view.on("pointer-move", function(event){ view.hitTest(event).then(function(response){ let highlight; if (response.results[0]) { var graphic = response.results[0].graphic; view.whenLayerView(graphic.layer).then(function(layerView){ highlight = layerView.highlight(graphic); }) } }) }); // Add the renderer to sceneLayer sceneLayer.renderer = { type: "simple", // autocasts as new SimpleRenderer() symbol: symbol }; }); </script> </head> <body> <div id="viewDiv"></div> </body> </html>
... View more
03-25-2019
05:36 AM
|
0
|
2
|
992
|
POST
|
Hello I seem to be running into an issue where when i run this code in an IDE such as pycharm the code run successfully however it doesnt seem to create any service area or polygons. I do have all the necessary licenses and I am using the correct interpreter. *This code does work in the python window in ArcPro. Any solutions?? Thanks import arcpy print ("Enter Workspace path :") workspace=input() arcpy.env.workspace = workspace print("running") arcpy.na.MakeServiceAreaAnalysisLayer("https://www.arcgis.com/", "Service Area", "Driving Time", "FROM_FACILITIES", "5;10;15", None, "LOCAL_TIME_AT_LOCATIONS", "POLYGONS", "STANDARD", "OVERLAP", "RINGS", "100 Meters", None, None) arcpy.na.AddLocations("Service Area", "Facilities", "Site", "Name Location #;CurbApproach # 0;Attr_Minutes # 0;Attr_TravelTime # 0;Attr_Miles # 0;Attr_Kilometers # 0;Attr_TimeAt1KPH # 0;Attr_WalkTime # 0;Attr_TruckMinutes # 0;Attr_TruckTravelTime # 0;Breaks_Minutes # #;Breaks_TravelTime # #;Breaks_Miles # #;Breaks_Kilometers # #;Breaks_TimeAt1KPH # #;Breaks_WalkTime # #;Breaks_TruckMinutes # #;Breaks_TruckTravelTime # #", "5000 Meters", None, None, "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "EXCLUDE", None) arcpy.na.Solve("Service Area", "SKIP", "TERMINATE", None, None) print("DT Ended")
... View more
07-12-2018
06:22 AM
|
0
|
1
|
720
|
POST
|
I have a set of point locations and would like to build a grid index using each point as its center. (Eventually, create a Map series). Is there a way to do this?
... View more
06-21-2018
01:23 PM
|
0
|
1
|
1023
|
Online Status |
Offline
|
Date Last Visited |
09-28-2021
11:21 AM
|