POST
|
I am trying to have two different tools that can be used by pressing different buttons. The first is the standard sketch widget. The second is using the sketchViewModel (different variable name and different layer) to let the user update the geometry of features. When i first use the sketch Widget everything works fine but when i use my "moveTool" it somehow interacts with the sketch Widget. Then when clicking drawn shapes it won't highlight them and therefor u can't delete them anymore. Am i missing something here? Below i try to put the relevant code parts: Sketch Widget: const sketchViewModelDraw = new SketchViewModel({
view,
updateOnGraphicClick: true,
dafaultUpdateOptions: {
toggleToolOnClick: true
}
});
const sketchDraw = new Sketch({
layer: sketchLayer,
view: view,
container: document.createElement("div"),
layout: "vertical",
sketchViewModel: sketchViewModelDraw
});
on(dom.byId("btnGeometry"),"click", function(){
view.ui.add(sketchDraw.container, "top-right");
view.ui.add(finishBtn,"bottom-right");
editExpand.expanded=false;
}); Move Tool: const moveGraphicsLayer = new GraphicsLayer({
id:"moveGraphics",
listMode:"hide",
title: "moveGraphicsLayer"
});
map.add(moveGraphicsLayer);
const moveSymbol = {
type:"simple-marker",
color: [255,255,0,0.4],
size: "20px",
outline: {
color: "blue",
width: "2px"
},
style: "circle"
};
const sketchViewModelMove = new SketchViewModel({
view,
layer: moveGraphicsLayer,
// pointSymbol: moveSymbol,
updatePointSymbol: moveSymbol,
updateOnGraphicClick: false,
dafaultUpdateOptions: {
toggleToolOnClick: true
}
});
view.hitTest(moveEvent).then(function(response2){
clickMove.style.display = "none";
moveEvent.stopPropagation();
console.log(response2);
var results2 = response2.results;
if (results2.length > 0) {
var i;
for (i = 0; i < results2.length; i++){
moveIndicator.style.display="block";
moveGraphic = results2[0].graphic;
moveGraphicsLayer.graphics.removeAll();
moveGraphicsLayer.graphics.add(moveGraphic);
sketchViewModelMove.update(moveGraphic, {tool: "move"});
}
}
else {
moveIndicator.style.display="none";
}
});
on(moveSaveBtn,"click", function(){
removeArrowsButtons();
let params = {updateFeatures: [moveGraphic]};
view.goTo({
center: moveGraphic.geometry
});
lyr.applyEdits(params).then(function(editsResult){
const resultId = editsResult.updateFeatureResults[0].objectId;
console.log("Object ID updated.. "+ resultId);
console.log("Lat "+ moveGraphic.geometry.latitude);
console.log("Lon "+ moveGraphic.geometry.longitude);
});
moveGraphicsLayer.graphics.removeAll();
sketchViewModelMove.complete();
clickMove.style.display = "block";
}); Thanks for any help.
... View more
05-10-2019
07:33 AM
|
0
|
0
|
707
|
POST
|
Thank you, i just checked it and can confirm the layer doesn't show up in the Layerlist anymore. Was just moving to 4.11 while in the process of trying to hide that item.
... View more
03-29-2019
11:08 AM
|
1
|
0
|
1110
|
POST
|
(API 4.11) Hi, i am trying to visualize Trees in real world size and it is working fine. The Problem is that when I measure the displayed diameter with the measure widget the size is correct for the "planar" mode but I actually want them to have the real world size in "geodesic" mode. Here is the code I use to render the FeatureLayer: var sr = new SimpleRenderer({
symbol: new SimpleMarkerSymbol({
color: [34,139,34, 0.7],
outline: {
color: [34,139,34],
width: 1
}
}),
label: "stamm",
visualVariables: [{
type: "size",
field: "KRONENDURC",
valueUnit: "meters", // values of Width_EW are expressed in feet
valueRepresentation: "diameter"
}]
}); As u can see the sample below shows a tree Feature with a diameter of 11 meters in planar mode. I actually want it to be 11 meters in Geodesic mode. Is there a way to do some math with size gathered through the "KONENDURC" field?
... View more
03-29-2019
08:53 AM
|
0
|
1
|
1023
|
POST
|
(API 4.11) Hi, as in the title i am trying to hide the layer, that the DistanceMeasureMent2D widget saves its Graphics on, in the LayerList widget. As i have no access to the layer i cannot set the listMode to hide (listMode: "hide"). Defining the operationalItems in the layerList is not the optimal solution as we wan't to change the layers dynamically via php. A small workaround i found in the GeoNet would be to not allow any Graphicslayers in the Layerlist widget: var layerList = new LayerList({
view: view,
container: document.createElement("div"),
listItemCreatedFunction: defineActions
});
layerList.operationalItems.on("before-add", function(event){
if (event.item.layer.type === "graphics") {
event.preventDefault();
}
}); That works fine for the moment but maybe in the Future we might want to have graphicslayers included. Changing the LayerListView.js is also not an option. tl;dr: How to access and hide the DistanceMeasurement2D-layer in the LayerList widget?
... View more
03-29-2019
08:19 AM
|
0
|
2
|
1238
|
POST
|
Thank you Bjorn, now it works fine. Best Regards, Michael
... View more
12-21-2018
08:20 AM
|
0
|
0
|
1538
|
POST
|
Hi, short question about a problem I faced when migrating from api version 4.9 to 4.10. With the script below i update the attributes of a feature (in agol feature service) when running the script. In 4.9 it worked fine but it doesn't in 4.10, without any errors. I checked the release notes but couldn't find any breaking changes related to that topic. Thanks! <script>
require([
"esri/layers/FeatureLayer",
"esri/Graphic",
"dojo/domReady!"
], function (FeatureLayer, Graphic
) {
var lyr = new FeatureLayer({
url: "https://services6.arcgis.com/..../arcgis/rest/services/Strassenbeleuchtung_Development/FeatureServer",
objectIdField: "FID",
outFields: ["*"]
});
var updateFeatArr = [];
updateFeatArr.push(new Graphic({
attributes: {LAMPENNUMM: "2", ARTVALUE: "LED", FID: 3}}));
return lyr.applyEdits({
updateFeatures: updateFeatArr
})
.then(function(results) {
});
});
</script>
... View more
12-19-2018
09:27 AM
|
0
|
4
|
1737
|
POST
|
view.on("click", function (event) {
event.stopPropagation();
var htr; // a single result from HitTestResult results[]
view.hitTest(event)
.then(function (response) {
if (response.results.length){
htr = response.results.filter(function (result) {
return result.graphic.layer === lyr;
})[0];
console.log(htr);
if (htr !== undefined){
var arr = [];
arr.push(htr.graphic);
view.popup.open({
location: htr.mapPoint,
features: arr
});
}
}
});
}); I'm using the above hitTest function to check wether the user clicked on a feature that is overlapped by a query result feature and open its popup. It is working fine but when clicking on two or more features at the same time i want the arrow to appear in the popup, so the user can switch through. Is it possible to return more than one result?
... View more
11-04-2018
09:58 AM
|
0
|
2
|
2279
|
POST
|
Robert Scheitlin, GISP, do you know sth for us? I am wondering nobody is having the same problem as ours.
... View more
11-04-2018
08:44 AM
|
0
|
3
|
1418
|
POST
|
I'm trying to build a tracking application with the geolocation api. The goal is a smooth and accurate mobile position tracking for pedestrians. When using the esri track widget I run into accuracy problems. The location point jumps around a lot and there are deviations from the actual location up to a few kilometers. Track current location | ArcGIS API for JavaScript 4.9 Having tried the geolocation options like "maximumAge", "timeout" & "enableHighAccuracy" there were no significant improvements. I also testet it on different devices and the issues where the same for all off them (iOs, Android). Having tried different applications this one worked quite good. https://openlayers.org/en/latest/examples/geolocation-orientation.html . I also like how the device heading works in this example but couldnt figure out how to use it with the arcgis javascript api. So are there any tools for the javascript 4.9 api that I could use?
... View more
10-27-2018
08:03 AM
|
0
|
4
|
1613
|
POST
|
Which API version do you use? With 4.7 the sensivity is a bit better. But still not perfect I think. Many inspectors of my company still complain about that...
... View more
09-17-2018
07:23 AM
|
0
|
1
|
1124
|
POST
|
Hi Robert, I dont understand if labeling (for example with angle) is possible for a "hosted feature layer" on AGOL in 4.8. Could you tell me? (Sorry I am not able relate the word "FeatureServer service".) Thank you, Michael
... View more
08-29-2018
07:38 AM
|
0
|
1
|
807
|
POST
|
Thanks a lot! I was using const dojoConfig instead of var.
... View more
08-20-2018
08:13 AM
|
0
|
1
|
798
|
POST
|
Is there a simple way to highlight features in a MapView when u click on them? I researched a bit and it seems there is a really easy way to do that in SceneView but it doesn't work with MapView. (highlightEnabled: true)
... View more
08-14-2018
10:00 AM
|
0
|
3
|
930
|
POST
|
I talked to esri support, they provided the solution for me. There have to be return commands when chaining promises. Like: lyr.queryFeatures(query)
.then(function(results) {
var featuresArray = new Array();
results.features.forEach(function(item) {
featuresArray.push(item.attributes);
});
})
//adding features
.then(function(results) {
return lyr.applyEdits({
addFeatures: createFeatArr
})})
//then updating features
.then(function(results) {
return lyr.applyEdits({
updateFeatures: updateFeatArr
})})
//and then quering featurelayer
.then(function(results) {
lyr.queryFeatures(query)
.then(function(results) {
var featuresArray = new Array();
results.features.forEach(function(item) {
featuresArray.push(item.attributes);
});
})});
... View more
07-23-2018
02:21 AM
|
0
|
0
|
1176
|
Title | Kudos | Posted |
---|---|---|
1 | 03-29-2019 11:08 AM | |
1 | 04-26-2018 04:23 AM | |
1 | 04-17-2018 05:24 AM | |
1 | 07-18-2017 07:01 AM | |
2 | 07-14-2017 12:53 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|