|
POST
|
Hi Majdoleen Apologies that I haven't responded until now, am not sure I am the best person to ask this to, perhaps better if you posted this into the ESRI javascript community as there are many folk better placed to help (I am also newish to javascript). Sorry I cannot assist further, good luck with your project! Mark
... View more
11-26-2019
07:41 AM
|
6
|
1
|
1670
|
|
POST
|
Hi Kory, Many thanks for the suggestion - alas, this still produces vertices where the lines intersect. Will keep looking for a solution. Best wishes, Mark
... View more
08-28-2019
07:47 AM
|
0
|
0
|
623
|
|
POST
|
Hi all I have an issue when trying to clip linear tracking data with a polygon area of interest. The problem is why in some cases, the tracks I am clipping end up with vertices at all linear intersections which is not what I want, and in some cases, I have tracks ending up with millions of vertices. This is easier to see in the following graphics: Unclipped track: Clipped track: So, my question is how to stop these additional vertices from being added (or is this something inherent in the geoprocessing algorithm and I have to live with it) I could of course manually edit these tracks but this will be massively time consuming. Any ideas would be gratefully received, unfortunately I cannot share this data. Best regards, Mark
... View more
08-28-2019
04:23 AM
|
0
|
2
|
650
|
|
POST
|
Why thank you Robert, this is exactly what I have been looking for and will assist me getting this functionality into my tool. Very best, Mark
... View more
08-23-2019
01:46 AM
|
4
|
1
|
1670
|
|
POST
|
Hi all With the ability to use graphic draw tools (point, line, polygons) and create the objects to use in a query such as those in this example: https://developers.arcgis.com/javascript/3/samples/util_buffergraphic/ How would I customise this so as to be able to enter x,y coordinates manually to create an object such as a point, line or polygon and then buffer this? I have a simple create a point object and zoom to it taking in user entered x,y coordinates using the following: on(dom.byId("btnFindCoordinates"), "click", function() { map.graphics.clear(); var x = dom.byId("xCoord").value; var y = dom.byId("yCoord").value; var coordPoint = new Point(x,y); prjParams.geometries = [coordPoint]; map.centerAndZoom(coordPoint, 11); map.graphics.add(new Graphic(coordPoint, markerSymbol)); }); But not sure how I would add this into the example above, any hints welcome. Thanks and best, Mark
... View more
08-22-2019
08:01 AM
|
7
|
5
|
1867
|
|
POST
|
Many thanks for the responses, after some reading around the subject I ended up using the following method.. newArray1 = spcAtObsCommon.map(object => object.species_common); newArray2 = spcAtISitesCommon.map(object => object.species_common); console.log([...new Set([...newArray1, ...newArray2])]);
... View more
08-15-2019
03:16 AM
|
0
|
0
|
2592
|
|
POST
|
Hi all Am struggling to merge two result arrays of species that I wish to display as a single list with no duplicates. The resulting arrays are in this format: 0: {species_common: "Black Kite"} 1: {species_common: "White Stork"} How would I go about merging both lists so I can display just the values like Black Kite, White Stork, etc in one list? I have tried doing this const object1 = [spcAtObsCommon]; const object2 = [spcAtISitesCommon]; const object3 = {...object1, ...object2 }; if I do a console.log(object3) all I see is the results from object2 in exactly the same format. What am I doing wrong? Any advice or pointers would be gratefully received. Best, Mark
... View more
08-07-2019
07:30 AM
|
0
|
3
|
2751
|
|
POST
|
Hi all I have just gone through the tutorial below to get an understanding of how to print a map from a webmap Tutorial: Modify the map legend and pass extra printing parameters using ArcPy—Documentation (10.7) | ArcGIS Enterpri… After some initial teething problems, I now have this working. Does anyone have any pointers as to how to progress this further and add a table to the layout, I am currently rewriting a web tool and have to add the ability to print a web map together with several related tables. Thanks in advance for any tips! Mark
... View more
07-11-2019
06:47 AM
|
1
|
0
|
382
|
|
POST
|
Hi all I am struggling with how to return a distance from a drawn geometry (polygon, extent, circle) that is buffered (user specified distance) and which then selects any features within that object. At the moment, I get the distance from the centre point of the object (A) and not the edge of the buffer start edge (B). Hopefully the following graphic should illustrate better what I need to calculate: Here is the code I am using (Version 3.28 api): /* function to create toolbar drawing shapes */ function initToolbar(evt) { tb = new Draw(map); tb.on("draw-complete", addGraphic); // event delegation so a click handler is not needed for each individual button on(dom.byId("info"), "click", function(evt) { if ( evt.target.id === "info" ) { return; } var tool = evt.target.id.toLowerCase(); map.disableMapNavigation(); tb.activate(tool); }); } function addGraphic(evt) { //deactivate the toolbar and clear existing graphics tb.deactivate(); map.enableMapNavigation(); var geometry = evt.geometry; var params = new BufferParameters(); params.distances = [dom.byId("distance").value]; params.outSpatialReference = map.spatialReference; params.unit = GeometryService[dom.byId("unit").value]; var symbol; if ( geometry.type === "point" || geometry.type === "multipoint") { userMP = evt.geometry; symbol = markerSymbol; } else if ( geometry.type === "line" || geometry.type === "polyline") { userMP = geometry; symbol = lineSymbol; } else if ( geometry.type === "extent") { userMP = geometry.getCenter(); symbol = lineSymbol; } else { userMP = geometry.getCentroid(); symbol = fillSymbol; } params.geometries = [geometry]; esriConfig.defaults.geometryService.buffer(params, showBuffer); map.graphics.add(new Graphic(geometry, symbol)); function showBuffer(bufferedGeometries) { var symbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0,0.65]), 2 ), new Color([255,0,0,0.35]) ); arrayUtils.forEach(bufferedGeometries, function(geometry) { var graphic = new Graphic(geometry, symbol); map.graphics.add(graphic); }); } on(esriConfig.defaults.geometryService, "buffer-complete", function(Geom){ queryMapService(Geom) }) /* Function to query layers based on tool geometry chosen e.g. polygon, circle etc */ function queryMapService(Geom){ var promises = []; /* query for feature layers */ var query = new Query(); query.outFields = ["*"]; query.returnGeometry = false; query.geometry = Geom.geometries[0]; function findClosestIBAs(features) { var geometryService = new GeometryService("../arcgis/rest/services/Utilities/Geometry/GeometryServer"); var promises; var dlist = []; var list = []; var rstr = ""; var ptloc, distp; for (var x = 0; x < features.length; x++) { var distParams = new DistanceParameters(); distParams.distanceUnit = GeometryService.UNIT_KILOMETER; distParams.geometry1 = userMP; distParams.geodesic = true; SitRecID = features .attributes["SitRecID"]; IntName = features .attributes["IntName"]; ptloc = features .geometry; distParams.geometry2 = features .geometry; dlist.push({name:IntName + " " + SitRecID, loc:ptloc}); distp = geometryService.distance(distParams); list.push(distp) } All(list).then(lang.hitch(this,function(results){ var shortestDist = Number.POSITIVE_INFINITY; var closestBlock = ""; for (var dv = 0; dv < dlist.length; dv++){ appendSensIBAs(dlist[dv].name + " is " + results[dv].toFixed(2) + "km"); rstr += dlist[dv].name + " is " + results[dv].toFixed(2) + "km"; if(results[dv] < shortestDist){ shortestDist = results[dv]; closestBlock = dlist[dv].name; } } })); } Any ideas or suggestions gratefully received! Thanks in advance, Mark
... View more
05-02-2019
01:56 AM
|
0
|
1
|
655
|
|
POST
|
Hi Robert Many thanks for this, as much as I have looked at pretty much all the examples I cannot seem to find anything to help me work out how to return the results of a query (user defined shape) and put these into a table that also shows related records. Lack of knowledge on my behalf but slowly getting there. Thanks again, Mark
... View more
03-18-2019
08:47 AM
|
0
|
0
|
1164
|
|
POST
|
Hi all Wondering if anyone can assist with how to display query results to a feature table? I have searched pretty much everything I can find but just cannot get this to work - I am beginning javascript and I am stumped as to how to get the query results to display in the feature table. I am using the Toolbar function to allow a user to draw a shape and select the features they want. These are the results I want to display. At the moment I can draw a shape and select the features I want and can see that these are returned in the console log but all features in the table are displaying in the table and not the subset. If I use a definition query to subset the layer then only those are displayed. If anyone has any suggestions I would be really grateful. I am using the feature table option as I like the way this handles related tables but happy to adopt other methods such as dgrid if anyone can point me in the right direction. Some of my code follow - (am using 3.27 api version) var featureLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services../MapServer/2",{ mode: FeatureLayer.MODE_ONDEMAND, showRelatedRecords: true, //definitionExpression: "objectid in (1176,1184)", outFields: ["*"] }); function initToolbar() { tb = new draw(map); tb.on("draw-end", addGraphic); // event delegation so a click handler is not // needed for each individual button on(dom.byId("info"), "click", function(evt) { if ( evt.target.id === "info" ) { return; } var tool = evt.target.id.toLowerCase(); map.disableMapNavigation(); tb.activate(tool); }); } function addGraphic(evt) { map.graphics.clear(); //deactivate the toolbar and clear existing graphics tb.deactivate(); map.enableMapNavigation(); // figure out which symbol to use var symbol; if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") { symbol = markerSymbol; } else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") { symbol = lineSymbol; } else { symbol = fillSymbol; } map.graphics.add(new graphic(evt.geometry, symbol)); queryMapService(evt.geometry); } //working code function queryMapService(Geom){ var promises = []; var featureId = []; var query = new Query(); query.returnGeometry = false; query.objectIds = [featureId]; //query.where = "1=1"; query.outFields = ["*"]; query.geometry = Geom; promises.push(featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW)); var allPromises = new All(promises); allPromises.then(function (r) { console.log(r); //r is an array of stuff loadTable(r); }); } //Array of stuff function loadTable(results){ var objectIds = objectIds; var featureTable = new FeatureTable({ featureLayer : featureLayer, map : map, syncSelection: false, showRelatedRecords: true, showAttachments: true, outFields: ["NatName"], }, 'myTableNodeSites'); featureTable.selectedRowIds = objectIds; featureTable.filterSelectedRecords(true); featureTable.startup(); } Thanks in advance, Mark
... View more
03-15-2019
04:52 AM
|
0
|
2
|
1324
|
|
POST
|
Hi all, I managed to solve it if any one else is stuck this is what I did - I just needed to add a tab container (after looking through the examples here specifically the nested layouts example: dijit/layout/BorderContainer — The Dojo Toolkit - Reference Guide SO I now have: <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;"> <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center', splitter:true" style="height:60%"> <div id="map"></div> </div> <div data-dojo-type="dijit/layout/TabContainer" data-dojo-props="region:'bottom', tabStrip:true" style="height:40%"> <div id='bot' data-dojo-type="dijit/layout/ContentPane" title="My first tab" selected="true"> <div id="myTableNodeSites"></div> </div> <div id='bot1' data-dojo-type="dijit/layout/ContentPane" title="My second tab"> <div id="myTableNodeSpp"></div> </div> </div><!-- end TabContainer --> </div><!-- end BorderContainer -->
... View more
03-04-2019
10:48 AM
|
0
|
0
|
1462
|
|
POST
|
Hi All I have several feature tables with related records that I would like to display but cannot seem to get my head around the structure. I am using this example as a starting point: FeatureTable - related records | ArcGIS API for JavaScript 3.27 here is my code: map.on("load", loadTableSites, loadTableSpecies); function loadTableSites(){ var myFeatureLayer = new FeatureLayer("../MapServer/2",{ mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"], visible: true, id: "fLayer" }); // apply the selection symbol for the layer var selectionSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.35]), 1), new Color([255, 0, 0, 0.35])); myFeatureLayer.setSelectionSymbol(selectionSymbol); // listen to featurelayer click event to handle selection // from layer to the table. // when user clicks on a feature on the map, the corresponding // record will be selected in the table. myFeatureLayer.on("click", function(evt) { var idProperty = myFeatureLayer.objectIdField; var feature, featureId, query; if (evt.graphic && evt.graphic.attributes && evt.graphic.attributes[idProperty]) { feature = evt.graphic, featureId = feature.attributes[idProperty]; query = new Query(); query.returnGeometry = false; query.objectIds = [featureId]; query.where = "1=1"; myFeatureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW); } }); map.addLayer(myFeatureLayer); // create new FeatureTable and set its properties var myFeatureTable = new FeatureTable({ featureLayer : myFeatureLayer, map : map, syncSelection: true, showRelatedRecords: true, showAttachments: true, // outfields outFields: ["SitRecID", "NatName"], }, 'myTableNode'); myFeatureTable.startup(); } /* Another table */ function loadTableSpecies(){ var myFeatureLayerSpp = new FeatureLayer("../MapServer/6",{ mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"], visible: true, id: "fLayer" }); // apply the selection symbol for the layer var selectionSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.35]), 1), new Color([255, 0, 0, 0.35])); myFeatureLayerSpp.setSelectionSymbol(selectionSymbol); // listen to featurelayer click event to handle selection // from layer to the table. // when user clicks on a feature on the map, the corresponding // record will be selected in the table. myFeatureLayerSpp.on("click", function(evt) { var idProperty = myFeatureLayer.objectIdField; var feature, featureId, query; if (evt.graphic && evt.graphic.attributes && evt.graphic.attributes[idProperty]) { feature = evt.graphic, featureId = feature.attributes[idProperty]; query = new Query(); query.returnGeometry = false; query.objectIds = [featureId]; query.where = "1=1"; myFeatureLayerSpp.selectFeatures(query, FeatureLayer.SELECTION_NEW); } }); map.addLayer(myFeatureLayerSpp); // create new FeatureTable and set its properties var myFeatureTableSpp = new FeatureTable({ featureLayer : myFeatureLayerSpp, map : map, syncSelection: true, showRelatedRecords: true, showAttachments: true, // outfields outFields: ["Common_name"], }, 'myTableNodeSpp'); myFeatureTableSpp.startup(); } I can use one or the other features and the records display in the feature table but I cannot work out ow to display both tables below the map. Here is the html part: <body class="claro esri"> <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;"> <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center', splitter:true" style="height:60%"> <div id="map"></div> </div> <div id="bot" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom', splitter:true" style="height:40%"> <div id="myTableNode"></div> </div> <div id="bot1" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom', splitter:true" style="height:40%"> <div id="myTableNodeSpp"></div> </div> </div Ideally I want to display the tables in respective tabs, I gather this is possible but am stuck. Any pointers or suggestions would be welcome. Many thanks,
... View more
03-04-2019
08:20 AM
|
0
|
1
|
1635
|
|
POST
|
Hi all Am trying to work out how to populate a popup with values from a related table using this as an example: Popup with related fields | ArcGIS API for JavaScript 3.27 Essentially, what I am trying to do is display a list of species (from a related table) that occur within a polygon and list these in the popup I have tried this: function loadTable(){ var popupTemplate = new PopupTemplate({ "title": "Site with species", "fieldInfos": [{ "fieldName": "NatName" }, { "fieldName": "relationships/0/SitNational", }, { "fieldName": "relationships/0/Common_name", }, ], "description": " there are these species: ", }); I can see the species returned in web developer but am struggling to find a way of listing these in the popup. Is it even possible to use this method to achieve this? Any advice or suggestions most welcome. Many thanks, Mark
... View more
01-23-2019
07:51 AM
|
0
|
0
|
447
|
|
POST
|
Hi Robert Many thanks for this, I will have a look and see if I can decipher this and get the functions to work within my tool. Very best regards, Mark
... View more
01-07-2019
09:10 AM
|
0
|
1
|
1629
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 11-26-2019 07:41 AM | |
| 7 | 08-22-2019 08:01 AM | |
| 4 | 08-23-2019 01:46 AM | |
| 1 | 07-11-2019 06:47 AM | |
| 1 | 02-15-2017 01:50 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|