|
POST
|
Thanks, I believe that I'm getting close. However, I don't understand how to get a reference to the clicked graphic in my map's on click event. For the featureLayers I perform and identifyTask to populate my featureArray with the features returned by my click event. How would I get a reference to the graphics that are returned by the click event? Thanks, Tyler
... View more
10-10-2017
10:43 AM
|
0
|
1
|
516
|
|
POST
|
Hi Robert, I think that I may need to do this in reverse using the map's on click event... just in case the user is not interested in information from the GraphicsLayer which will be points. Is that possible too or do you advise a different workflow? Thanks, Tyler
... View more
10-10-2017
08:33 AM
|
0
|
8
|
1801
|
|
POST
|
Hi Robert, I'm not sure how to do that with a GraphicsLayer. Here's a quick rundown of how I am setting up the identifyTask for my featureLayers. I have my identify Parameters set up like this: var identifyParams = new IdentifyParameters(); identifyParams.tolerance = 10; identifyParams.returnGeometry = true; //identifyParams.geometryPrecision = 1; //identifyParams.layerIds = [0, 2]; identifyParams.layerOption = IdentifyParameters.LAYER_ALL; identifyParams.width = map.width; identifyParams.height = map.height; I then loop over my featureLayers adding their URLs to an identifyTaskArray: identifyTaskArr.push(new IdentifyTask(layers.url)); Lastly, I loop over the identifyTaskArray and execute the identifyTasks using the identifyParameters: for (var j=0;j<identifyTaskArr.length;j++){ var deferred = identifyTaskArr .execute(identifyParams) .addCallback(function (response) { var featureArr = []; for (var k=0;k<response.length;k++) { var feature = response .feature; //construct jsonTitle and jsonCOntent here based on feature attibutes //setting template content here var json = {title:jsonTitle ,content: jsonContent}; var testTemplate = new InfoTemplate(json); feature.setInfoTemplate(testTemplate); // Add to list featureArr.push(feature); } return featureArr; }); deferredList.push(deferred); } map.infoWindow.setFeature.(deferredList); map.infoWindow.show(event.mapPoint); I've never performed an identifyTask on GraphicsLayers. I'm currently using a graphicsLayer on click event to pop up my infowindow(which is sub-optimal). I quess what I'm most confused about is what URL parameter I would use to create my IdentifyTask for my graphicsLayers. I am creating my graphicsLayers on the fly from attributes and coordinates from another database. Thanks for your help. Tyler
... View more
10-10-2017
07:21 AM
|
0
|
10
|
1801
|
|
POST
|
I have an ArcGIS.js 3.22 application that loads a number of FeatureLayers in a map and then constructs and loads a number of GraphicsLayers. I have a click event that runs an IdentifyTask on each of the FeatureLayers in the map. It's nice because the identify task loads feature information for overlapping layers into the infoTemplate. The user is able to click the infoTemplate's arrow and cycle through features identified across all featureLayers present at a click point. I would like to include graphicsLayer information into the infoTemplate along with featureLayer information so that the user may loop over all features returned by their mouse click. I want the infoTemplate to show attribute information from both the featureLayers and the graphicsLayers. Is this possible? Dose anyone have an idea of how this would be done? It looks like ArcGIS.js 4.5 allows you to greate feature layers from graphics using the graphicsLayer's 'source' property. Can the source property in 3.22 be used similarly? Thanks, Tyler
... View more
10-10-2017
06:23 AM
|
0
|
14
|
2709
|
|
POST
|
Greetings, It turns out that both the 'Accept' and 'Content-Type' headers need to be set to 'application/x-www-form-urlencoded' . i.e request.setHeader('Content-Type', 'application/x-www-form-urlencoded'); request.setHeader('Accept', 'application/x-www-form-urlencoded') Thanks to Nick from ESRI support Best, Tyler P.S. also be sure not to compress the data. i.e. request.setCompressed(true); you can however set the content length. i.e. request.setHeader('Content-Length', String.valueOf(bodyLength));
... View more
09-20-2017
11:37 AM
|
5
|
0
|
3741
|
|
POST
|
I am accessing ArcGIS Server REST API geometry server in a Java application to do some analysis. I expect to be buffering lines and polygons and plan to use a post request due to the length restrictions on a 'GET' request. I have structured my HttpRequest's endpoint and body correctly and verified my response using Postman v5.2.0 which is powered by Asp.Net. I am using Java to make requests to the geometry server. When I make a geometry server buffer request from my Java application, I get a 200 status. However, the response from the server is not a buffer response. Instead, my response is the HTML form from the buffer tool's endpoint. I.E. : <html lang="en"> <head> <title>Buffer (GeometryServer)</title> <link href="https://community.esri.com/arcgis1/rest/static/main.css" rel="stylesheet" type="text/css"/> </head> <body> <table width="100%" class="userTable"> <tr> <td class="titlecell"> ArcGIS REST Services Directory </td> <td align="right"> ....... I did a quick internet search and found a related post on esri's resource-proxy's GitHub page: POST to geometry service for 'PROJECT' is returning HTML instead of JSON · Issue #332 · Esri/resource-proxy · GitHub Is this issue on the resource-proxy GitHub site related to making REST endpoint POST requests from a Java application? The Java code that I am using to perform the POST request is: Http httpProtocol = new Http(); HttpRequest request = new HttpRequest(); String reqBody = 'geometries=-78.868242630049537,35.773265772338988&inSR=4326&outSR=4326&bufferSR=102113&distances=1000&f=json'; Integer bodyLength = reqbody.length(); request.setEndPoint('http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/buffer'); request.setMethod('POST'); request.setBody(reqBody); request.setCompressed(true); request.setHeader('Accept', 'application/json'); request.setHeader('Content-type', 'application/json' ); request.setHeader('Content-Length', String.valueOf(bodyLength)); HttpResponse response = httpProtocol.send(request); system.debug('response.getBody(): ' + response.getBody()); system.debug('response: ' + response); Has anyone else had this issue or know of a work around? Any help or suggestions will be greatly appreciated. Thanks, Tyler
... View more
09-18-2017
09:41 AM
|
0
|
2
|
6610
|
|
POST
|
Hi Thomas Solow, I wasn't able to get this exact example to work in my production environment. However, ended up getting something similar to your example to work. for(var i =0; i < features.length ; i++){ var g = new Graphic(features.geometry, markerSymbol); graphicsLyr.add(g) ; } Thanks for all of your help on this. Tyler
... View more
08-02-2017
05:59 AM
|
0
|
0
|
2542
|
|
POST
|
Thomas Solow, I created a HTML/ESRI JavaScript API 3.21 that I created for ESRI support. I thought I'd share it here too. To reproduce the 'phantom graphic' issue follow these steps: 1. Preview the attached html file. 2. Click on the map near some trees to reverse geocode a point. 3. Click on the 'Buffer & Find nearby trees' button in the resultant popup window to create a graphics layer that shows the selection set of trees within 0.1 miles of your click point. 4. With the light blue selection set added to the map as a graphics layer, zoom in one step and the 'phantom-graphics' will appear.
... View more
08-01-2017
07:14 AM
|
0
|
1
|
2542
|
|
POST
|
Thanks for the suggestion. I tried the features.forEach() method and the problem still persists. Let me know if you have any other thoughts or suggestions and I'll give them a try. Thanks again.
... View more
07-24-2017
06:57 AM
|
0
|
0
|
2542
|
|
POST
|
Hi Thomas, Thanks for your comments. This application is in 3.21 I am using a plain ol' featureLayer.queryFeatures() query using a distance and geometry(point) option. I am applying a SimpleRenderer to the GraphicsLayer using a SimpleMarkerSymbol. Here's the generalized breakdown of the code I am using for this operation. First, I create a circle graphic and add it to a GraphicsLayer: circle = new Circle({ center: mapGlobals.bufferPoint , geodesic: true , radius: distMiles , radiusUnit: "esriMiles" }); var graphic = new Graphic(circle, bufferSymbol); var bufferGraphicsLayer = map.getLayer("bufferGraphicsLayer"); bufferGraphicsLayer.clear(); bufferGraphicsLayer.add(graphic); Next, I create a query on my feature layer: var query = new Query(); query.returnGeometry = true; query.outFields = ["*"]; query.geometry = mapGlobals.bufferPoint; query.distance = distMiles; query.units = "miles"; Next, I create or clear my point line or polygon graphicsLayers: if (!map.getLayer("pointCIP_GL")) { renderer = new SimpleRenderer(markerSymbol); graphicsLayerId = "pointCIP_GL"; var point_GL = new GraphicsLayer(); point_GL.id = graphicsLayerId; point_GL.renderer = renderer; map.addLayer(point_GL); } else { map.getLayer("pointCIP_GL").clear(); } if (!map.getLayer("polylineCIP_GL")) { renderer = new SimpleRenderer(lineSymbol); graphicsLayerId = "polylineCIP_GL"; var polyline_GL = new GraphicsLayer(); polyline_GL.id = graphicsLayerId; polyline_GL.renderer = renderer; map.addLayer(polyline_GL); } else { map.getLayer("polylineCIP_GL").clear(); } if (!map.getLayer("polygonCIP_GL")) { renderer = new SimpleRenderer(fillSymbol); graphicsLayerId = "polygonCIP_GL"; var polygon_GL = new GraphicsLayer(); polygon_GL.id = graphicsLayerId; polygon_GL.renderer = renderer; map.addLayer(polygon_GL); } else { map.getLayer("polygonCIP_GL").clear(); } I then query each of the featureLayers in a Theme JSON object (CIPTheme): for (i in CIPTheme.layers) { var layer = CIPTheme.layers; console.log(JSON.stringify(layer.id)) var featureLayer = map.getLayer(layer.id); outerLayerCount++; featureLayer.queryFeatures(query, function (featureSet) { var feature; var features = featureSet.features; var featureType; var graphicsLayerId; var renderer; var infoTemplate; innerLayerCount++; if (features.length > 0) { featureType = features[0].geometry.type switch (featureType) { case "point": map.getLayer("pointCIP_GL").graphics = features; //if I don't call .redraw() method on these layers the graphicsLayer does not draw in until //the map zooms but the 'phantom graphics' do not show up. However if I call redraw here the //graphicsLayer draws initially but after zoom change the 'phantom graphics' show up. // point_GL.redraw(); break; case "polyline": polyline_GL.graphics = features; // polyline_GL.redraw(); break; case "polygon": map.getLayer("polygonCIP_GL").graphics = features; // polygon_GL.redraw(); break; } } From here I go on to create custom JSON objects from the graphics attributes for use in visualizations outside the map. Please let me know if I may provide additional details or snipits. Thanks, Tyler
... View more
07-21-2017
05:24 AM
|
0
|
3
|
2542
|
|
POST
|
Greetings, This is definitely strange. I am selecting features from a point, a polyline and a polygon featurelayer by distance from a point. I'm creating a graphics layer for each featuretype and highlighting the graphics in the map. All feature types but the points display properly. The points however, maintain a set of phantom graphics that persist at the zoomscale at which they were created. So when you zoom in, there appear to be a second set of point graphics with the same geometry relationship but at the scale at which the graphics layer was first drawn. The interesting this is that if I add the graphics to the graphicsLayer and do not refresh programmatically, then when the graphics layer redraws when the zoom scale is changed there is no issue. However, if I redraw the graphics layer programmatically then the issue presents. I've dug in a little to try to debug this situation. I created a mouseover event on the graphics in the graphicsLayer but the phantom graphics do not respond. The length of the graphics in the graphics layer does not include the phantom graphics either. Has anyone ever seen this? Also, what method does a zoom change call on the graphicsLayer? I had assumed that redraw was called on the graphicsLayer but redraw also causes the issue to present. Please see the image that I have included. The 'Phantom Graphics' are outlined in black. I have zoomed in and drawn black lines to the points that these phantom graphics correspond with at the initial scale that graphics layer was drawn at. Any information or tips will be greatly appreciated. Tyler
... View more
07-20-2017
09:06 AM
|
0
|
11
|
3553
|
|
POST
|
Greetings, I have a web map application that I am trying to optimize for touchscreens. I have a reverse geocode that brings up an info window with address details. On touchscreens, when I click the close button on the info window, another map click event is simultaneously fired... which subsequently revers geocodes another address and info window. How can I close the info window without registering a map click event. it is conceivable that the user would want to reverse geocode multiple consecutive locations, just not when they are closing the info window button. Thanks, Tyler
... View more
07-11-2017
11:01 AM
|
0
|
1
|
1082
|
|
POST
|
Greetings, I am working to extend the Custom info window example to work with a webmap loaded using arcGISUtils.createMap. I'm not sure if loading the webmap changes or is missing some parameter that the map.infoWindow option needs to load a custom info window or if my logic is unsound. Regardless, a structure that is sound otherwise, fails produces an obscure error when I try to load a custom infoTemplate. The error that I am receiving is: init.js:2377 Uncaught TypeError: d.clearFeatures is not a function at Object.Fa (init.js:2377) at Object.c [as onClick] (init.js:119) at Object._fire (init.js:1296) at Object._fireClickEvent (init.js:1303) at init.js:63 Any thoughts or suggestions will be greatly appreciated. Thanks, Tyler The extended example that I am working on is: <!DOCTYPE html>
<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>Custom Info Window</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.21/esri/css/esri.css">
<link rel="stylesheet" href="myModules/InfoWindow.css">
<style>
html,
body,
#mapDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<script>
var dojoConfig = {
parseOnLoad: true
, packages: [{
"name": "myModules"
, "location": location.pathname.replace(/\/[^/]+$/, "") + "/myModules"
}]
};
</script>
<script src="https://js.arcgis.com/3.21/"></script>
<script>
require([
"dojo/dom"
, "dojo/dom-construct"
, "esri/map"
, "esri/arcgis/utils"
, "myModules/InfoWindow"
, "esri/layers/FeatureLayer"
, "esri/InfoTemplate"
, "dojo/string"
, "dojo/domReady!"
], function (dom, domConstruct, Map, arcgisUtils, InfoWindow, FeatureLayer, InfoTemplate, string) {
//create the custom info window specifying any input options
var infoWindow = new InfoWindow({
domNode: domConstruct.create("div", null, dom.byId("mapDiv"))
});
//create the map and specify the custom info window as the info window that will
//be used by the map
var theme = {
"layers": [
{
"url": "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Street_Trees/FeatureServer/0"
, "visibility": true
, "opacity": 1
, "title": "Trees"
, "id": "trees"
, "outFields": ["*"]
, "infoWindow":{
"header": "${qSpecies}"
, "content": "<b>Address:</b>${qAddress}<br>"
}
}
]
}
var webmap = {}
webmap = {
"item": {
"title": "trees"
, "snippet": "Trees in London"
}
, "itemData": {
"operationalLayers": [{}
]
, "baseMap": {
"baseMapLayers": [
{
"opacity": 1
, "visibility": true
, "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
}
]
, "title": "London Treemap"
}
, "version": "1.1"
}
}
var mapDeferred = arcgisUtils.createMap(webmap, "mapDiv", {
mapOptions: {
center: [-122.41, 37.78]
, zoom: 17
, slider: true
, nav: false
, smartNavigation: false
, scrollWheelZoom: true
, infoWindow: infoWindow
}
});
mapDeferred.then(function (response) {
map = response.map;
//map.infoWindow = infoWindow
function loadLayers(layerArray) {
require(["esri/layers/FeatureLayer", "esri/InfoTemplate"], function (FeatureLayer, InfoTemplate) {
//webmap.itemData.operationalLayers = [];
//console.log("webmap.itemData.operationalLayers: " + JSON.stringify(webmap.itemData.operationalLayers))
var fLayers = [];
for (var i = 0; i < layerArray.length; i++) {
var layer = layerArray;
//for (var property in layer) {
//console.log('item ' + i + ': ' + property + '=' + layer[property]);
var fLayer;
if (layer.infoWindow) {
var iwHeader = layer.infoWindow.header;
var iwContent = layer.infoWindow.content;
console.log(iwHeader);
console.log(iwContent);
var template = new InfoTemplate(iwHeader, iwContent);
console.log(template);
fLayer = new FeatureLayer(layer.url, {
mode: FeatureLayer.MODE_ONDEMAND
, id: layer.id
, outFields: layer.outFields
, opacity: layer.opacity
, visibility: layer.visibility
, infoTemplate: template
})
}
else {
fLayer = new FeatureLayer(layer.url, {
mode: FeatureLayer.MODE_ONDEMAND
, id: layer.id
, outFields: layer.outFields
, opacity: layer.opacity
, visibility: layer.visibility
})
}
fLayers.push(fLayer);
}
map.addLayers(fLayers);
});
}
loadLayers(theme.layers)
//resize the info window
map.infoWindow.resize(180, 75);
});
});
</script>
</head>
<body>
<div id="mapDiv"></div>
</body>
</html>
... View more
07-10-2017
07:50 AM
|
0
|
0
|
1076
|
|
POST
|
Greetings, Anyone have any ideas on the best way to retrieve and display data in a one to many table relation? Thanks, Tyler
... View more
11-17-2016
01:46 PM
|
0
|
0
|
867
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-28-2016 03:05 PM | |
| 5 | 09-20-2017 11:37 AM | |
| 2 | 01-28-2019 12:21 PM | |
| 1 | 10-16-2017 12:56 PM | |
| 1 | 10-07-2014 07:04 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|