POST
|
Hey @AaqibJamshed , as far as I know you're right - the fullExtent-Function only works with layers. You could loop each layer in the map to get the extent for each layer. Then use the union function from GeometryService class
... View more
11-15-2021
01:26 AM
|
0
|
0
|
234
|
POST
|
Why don't you use the map and additionally add the layer? After zooming in or any other action just remove the layer again.
... View more
11-08-2021
11:20 PM
|
1
|
1
|
1503
|
POST
|
Hey @KenBuja no, my response is a area... Thanks for the supplement.
... View more
11-08-2021
08:43 AM
|
0
|
0
|
1523
|
POST
|
Hey @nadmoat , you can get the templateOptions using the watchUtils. watchUtils.watch(print.templateOptions,"layout", (event)=>{
console.log(event)
});
... View more
11-08-2021
03:31 AM
|
0
|
0
|
481
|
POST
|
Hey, @AwesomeEvan 1. Add the Layer to map while using a definitionExpression 2. Wait for the LayerView and use the queryExtent Function view.whenLayerView(layer).then(function(layerView) {
layerView.watch("updating", function(val) {
if (!val) {
layerView.queryExtent().then(function(response) {
view.goTo(response.extent);
});
}
});
});
... View more
11-08-2021
03:09 AM
|
0
|
3
|
1537
|
POST
|
Hey @GaryB I had the same problem today. My solution was to assign each layer an id which is equal to his initial position in the layer. Surely you could also use another layer attribute. //sample layers
const graphicsLayer1 = new GraphicsLayer({
title: "samplelayer1",
id: 1
});
map.add(graphicsLayer1);
const graphicsLayer2 = new GraphicsLayer({
title: "samplelayer2",
id: 2
});
map.add(graphicsLayer2);
//triggeraction-part
else if (id === "move-layer-up"){
position = event.item.layer.id;
if (1 !== +position){
new_position = +position - +1;
event.item.layer.id = new_position;
console.log("new position: "+event.item.layer.id)
layerList.viewModel.moveListItem(event.item, null, null, new_position);
}
}
else if (event.action.id === "move-layer-down") {
maxPosition = layerList.viewModel.operationalItems.length
console.log("maxPosition:"+maxPosition);
position = event.item.layer.id;
if (maxPosition !== +position){
new_position = +position + +1;
event.item.layer.id = new_position;
console.log("new position: "+event.item.layer.id)
layerList.viewModel.moveListItem(event.item, null, null, new_position);
}
}
... View more
10-27-2021
09:05 AM
|
1
|
0
|
612
|
POST
|
Thanks @Noah-Sager My goal is to create a sketch widget with the possibility to add notes to the map using the API 4.21 - not 4.9 as it was used in my example. All in one exactly what your example does... Thanks a lot, this will work for me!
... View more
10-20-2021
12:07 AM
|
1
|
0
|
1527
|
POST
|
Hey, i would like to offer the users the possibility to add some text to the map. I tried with the following code https://community.esri.com/t5/arcgis-api-for-javascript-questions/how-to-add-draw-widget-along-with-text-labels/td-p/111699 That's works fine but it's done for API4.9, not 4.21. When changing to 4.21 in the "<script> part" it runs into an error or several functions don't work well.I tried to figure out the difference for a while but didn't find any solution. Can someone help me? Maybe someone also finds an easier or another way to realize my issue...
... View more
10-19-2021
08:53 AM
|
0
|
3
|
1549
|
POST
|
Thanks again for your fast reply @ReneRubalcava The Solution that works for me is; layerList.on("trigger-action", (event) => { var activeLayer = event.item.layer.name; console.log(activeLayer); }); Defining the 'name" in the layer definition...
... View more
10-19-2021
01:41 AM
|
0
|
1
|
772
|
POST
|
Thanks for your reply @ReneRubalcava I tried with the following snippet; layerList.on("trigger-action", (event) => { layerList.selectedItems.watch("ListItem",layer =>{ console.log("do something"); }); }); But the console.log doesn't return anything.
... View more
10-18-2021
09:04 AM
|
0
|
0
|
801
|
POST
|
Hey, i just tried to add some actions to my layerlist widget. (increase/decrease opacity, zoom to extent) In this example they called a special layer by name but i want to use this actions on each layer in my map. Isn't there an easy way to define the selected Layer in the layerList widget? I didn't find anything easy like "var layer = layerlist.selectedLayer" Thank you
... View more
10-18-2021
07:46 AM
|
0
|
5
|
836
|
POST
|
Using the following code snippet resulted in succes! view.whenLayerView(bplan_feature).then(function(layerView) {
layerView.watch("updating", function(val) {
// wait for the layer view to finish updating
if (!val) {
layerView.queryExtent().then(function(response) {
// go to the extent of all the graphics in the layer view
view.goTo(response.extent);
});
}
});
}); Thanks for your help KenBuja!
... View more
02-08-2021
06:33 AM
|
0
|
0
|
1991
|
POST
|
Thanks, now it works when using the topo-vector basemap. But it still doesn`t work when using the custom basemap.
... View more
02-08-2021
06:08 AM
|
0
|
2
|
1999
|
POST
|
Thanks for your reply! I tried that already but still the same behaviour. The coordinate-system is projected, does that affect?
... View more
02-08-2021
05:11 AM
|
0
|
0
|
2016
|
POST
|
Hello, I tried to develope a map with JS API4 that shows several features depending on the used url. So if you call "https://serverurl/Map.html?fs=Feature1 i would like the map to zoom to that features. My problem is, that the map doesn't zoom to the feature. I think it could be a spatial reference problem but i'm not able to fix it. <html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Bebauungsplan Protoyp API4</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.18/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.18/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/layers/ImageryLayer",
"esri/widgets/LayerList",
"esri/widgets/Search",
"esri/portal/Portal",
"esri/layers/Layer",
"esri/layers/MapImageLayer",
"esri/layers/ImageryLayer",
"esri/Basemap",
"esri/geometry/Extent",
"esri/geometry/SpatialReference"
], function(
Map,
MapView,
FeatureLayer,
ImageryLayer,
LayerList,
Search,
Portal,
Layer,
MapImageLayer,
ImageryLayer,
Basemap,
Extent,
SpatialReference
)
{
if ('URLSearchParams' in window) { // Feature detection (URLSearchParams is not supported by Internet Explorer)
var url = new URL(document.URL);
var search_params = url.searchParams;
if(search_params.has('fs')) {
var url_bplan = search_params.get('fs');
var expr = "bemerkung = '"+url_bplan+"'";
} else {
expr1 = "leer";
}
};
var bplan_feature = new FeatureLayer({
url: "https://serverurl/FeatureServer/1",
outFields: ["*"],
definitionExpression : expr,
title : "Layer",
});
var baselayer = new ImageryLayer({
// URL to the imagery service
url: "https://serverurl/ImageServer",
wkid: 25832
});
var basemap = new Basemap({
baseLayers: [baselayer],
title: "Luftbild 2020"
})
var map = new Map({
basemap: basemap,
});
var view = new MapView({
container: "viewDiv",
map: map
});
map.add(bplan_feature);
view.goTo(bplan_feature);
//add layerlist
var layerList = new LayerList({
view: view,
selectionEnabled : true
});
view.ui.add(layerList, {
position: "top-right",
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html> What you see is just a part of the script but I think one can see the problem. Using the goTo Method results in nothing. Features and Basemap are all in 25832 UTM Thanks for your help
... View more
02-08-2021
01:48 AM
|
0
|
6
|
2078
|
Title | Kudos | Posted |
---|---|---|
1 | 11-08-2021 11:20 PM | |
1 | 10-27-2021 09:05 AM | |
1 | 10-20-2021 12:07 AM | |
1 | 10-28-2019 12:06 AM |
Online Status |
Offline
|
Date Last Visited |
04-07-2022
06:13 AM
|