POST
|
Tracy, Thanks for the information. Unfortunately, it didn't work. It returns all the field string except the calculation. I think that calculation didn't executed when we call the function. Please check here; var template = new esri.InfoTemplate(); template.setTitle("<b>Cooperator: </b> ${Cooperator}"); template.setContent; function setContent(value){ var formatString = "<b>Property Name: </b> + value.attributes.PropertyName + <br/>"; var sqft = geometryEngine.geodesicArea(value.geometry, "square-feet"); var squarefeet = number.format(sqft, { places: 1 }); var acres = number.format(sqft / 43560, { places: 0 }); formatString += "acres: " + acres; return formatString; }
... View more
02-01-2016
12:22 PM
|
0
|
0
|
528
|
POST
|
I have an issue with info template window. I used set content method to display calculated value by geometry engine service. It works fine for displaying calculated value but cannot join other fields information. Here is my code: var template = new esri.InfoTemplate(); template.setTitle("<b>Cooperator: </b> ${Cooperator}"); template.setContent("<b>PropertyName: <b> ${PropertyName} <br>"); // this cannot be displayed template.setContent(getTextContent); var layer = new FeatureLayer("URL", { infoTemplate: template, outFields: ["*"], opacity: 0.5 }); // convert squarefeet to acre function getTextContent(value) { var sqft = geometryEngine.geodesicArea(value.geometry, "square-feet"); var squarefeet = number.format(sqft, { places: 1 }); var acres = number.format(sqft / 43560, { places: 0 }); return "Acres :" + acres ; }; map.addLayers([layer]);
... View more
02-01-2016
10:01 AM
|
0
|
5
|
1876
|
POST
|
Thanks Robert. It works well. Appreciated your help.
... View more
01-29-2016
01:49 PM
|
0
|
0
|
345
|
POST
|
I have been trying to display annotation layer in REST api, I published the layer from map document including other feature layers but I didn't see this layer besides other layers. Is there way to display this layer? Any helps are appreciated.
... View more
01-29-2016
09:44 AM
|
0
|
2
|
1802
|
POST
|
Awesome Tom!. That works great. I didn't realize geometry engine is powerful one. I have been digging out all this morning to fix this issue. Thank you so much for the help!. Truly appreciated!!
... View more
01-28-2016
12:16 PM
|
0
|
2
|
1398
|
POST
|
Hi, I am also having the same issue. I was going to display SHAPE.STArea field in Rest API to convert it into Acreage unit dynamically in web map but code works for other numerical field but not just this field. I didn't see this field displayed in REST API even though I made field checked-on visible in map document. Any help is highly appreciated.
... View more
01-28-2016
07:47 AM
|
0
|
2
|
1475
|
POST
|
Here is my code: <!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>Map and Layer</title> <link rel="stylesheet" href="https://js.arcgis.com/3.15/esri/css/esri.css"> <style> html, body, #map { height: 100%; margin: 0; } #info { position: absolute; right: 0; top: 0; padding: 10px; background-color: #999; font: 14px Segoe UI; width: 200px; text-align: center; border-radius: 0 0 0 10px; } </style> <script src="https://js.arcgis.com/3.15/"></script> <script> var map, calculateAcreage; require([ "esri/map", "esri/layers/FeatureLayer", "esri/InfoTemplate", "esri/dijit/Legend", "esri/Color", "dojo/number", "dojo/domReady!" ], function( Map, FeatureLayer, InfoTemplate, Legend, Color, number ) { map = new Map("map", { basemap: "gray", center: [-97.144, 34.174], zoom: 6 }); map.on("layers-add-result", createLegend); var infoTemplate = new InfoTemplate( "${Name}, "${SHAPE.STArea()} sq.ft is equivalent to ${SHAPE.STArea():calculateAcreage} acres." ); var layer = new FeatureLayer("http://url", { infoTemplate: infoTemplate, outFields: ["*"], opacity: 0.5 }); // convert squarefeet to acre calculateAcreage = function(value) { var squarefeet = (value.hasOwnProperty("attributes")) ? value.attributes.SHAPE.STArea() : value; return number.format(squarefeet / 43560, { places: 2 }); }; map.addLayers([layer]); function createLegend(results) { var legend = new Legend({ layerInfos: [{ layer: results.layers[0].layer, title: " " }], map: map }, "legend"); legend.startup(); } }); </script> </head> <body> <div id="map"></div> <div id="info"> <div style="font-size: 36px;">Acreage of Cooperator Land.</div> <div id="legend"></div> </div> </body> </html>
... View more
01-27-2016
02:56 PM
|
0
|
6
|
4394
|
POST
|
Tom, is there way you can make spatial query on feature layer that return geometry spatially without returning attributes? Thanks
... View more
01-19-2016
03:34 PM
|
0
|
3
|
322
|
POST
|
Thank you for all your help Jake. I think I will figure out at some point of time. Appreciated your time and support!
... View more
01-07-2016
07:27 AM
|
0
|
0
|
108
|
POST
|
I did not see any errors jake. Can you check here if anything is missing? Edit fiddle - JSFiddle
... View more
01-07-2016
07:06 AM
|
0
|
2
|
995
|
POST
|
Jake I did exactly the way you did but still it did not return the pond geometries. In addition, do I need to add layer to display pond layer? It has only displayed boundary layer. You can check the script and let me know if I need anything. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Sample Map</title> <link rel="stylesheet" href="http://js.arcgis.com/3.15/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } </style> <script src="http://js.arcgis.com/3.15/"></script> <script> var map; require([ "esri/map", "esri/layers/FeatureLayer", "esri/tasks/query", "esri/tasks/QueryTask", "esri/geometry/Polygon", "esri/SpatialReference", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color", "esri/graphic", "dojo/dom", "dojo/on", "dojo/_base/array", "dojo/domReady!" ], function( Map, FeatureLayer, Query, QueryTask, Polygon, SpatialReference, SimpleFillSymbol, SimpleLineSymbol, Color, Graphic, dom, on, array ) { map = new Map("mapDiv", { basemap: "topo", center: [-97.144, 34.174], zoom: 8 }); var featureLayer = new FeatureLayer("http:xxxx/webgis/rest/services/Cooperators/cooperatorboundaryandpond/FeatureServer/0",{ mode: FeatureLayer.MODE_SNAPSHOT, outFields: ["*"], opacity: 0.75 }); featureLayer.setDefinitionExpression("EntityID = '9410'"); map.addLayer(featureLayer); var query = new Query(); query.where = ["1=1"]; featureLayer.queryFeatures(query, function(featureSet) { geometry = featureSet.features[0].geometry; var query = new Query(); var queryTask = new QueryTask("http:xxxx/webgis/rest/services/Cooperators/cooperatorboundaryandpond/FeatureServer/1"); query.geometry = geometry; query.returnGeometry = true; queryTask.execute(query, function(graphic){ array.forEach(graphic.features, function(feature){ var polygonJson = {"rings": feature.geometry.rings, "SpatialReference":{wkid:102725}}; var polygon = new Polygon(polygonJson); var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 2),new Color([255,255,0,0.25]) ); var graphic = new Graphic(polygon, sfs); map.graphics.add(graphic); }) }) }); }); </script> </head> <body> <div id="mapDiv"></div> </body> </html>
... View more
01-06-2016
09:30 AM
|
0
|
4
|
995
|
POST
|
Jake- that is great. This is something I need however, I experience problem on retrieving the exact polygon geometries. Is there way I can return polygon geometry ( not points) from the feature data that intersect with other polygon layer? In my data, there are numerous property boundaries (polygons) and I need to filter out ponds (polygon) in order to display only within those boundaries. I would be glad to get code snippets if you have. Thank you and appreciated your help
... View more
01-05-2016
02:52 PM
|
0
|
6
|
995
|
Title | Kudos | Posted |
---|---|---|
1 | 12-19-2016 11:48 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|