|
POST
|
No, there aren't any layer properties native to the API that support layer ordering. That's not to say you can't simply assign one though. For example: var layer1 = new MapImageLayer({url:"someURL"});
layer1.myLayerOrder = 1;
var layer2 = new MapImageLayer({url:"someOtherURL"});
layer2.myLayerOrder = 2; You would just need to ensure you assign that custom property for all the layers in your application.
... View more
01-09-2023
09:45 AM
|
0
|
0
|
2330
|
|
POST
|
I wasn't certain that would work, but it was worth a try. In this case, I think you must fix the extent so that it starts on the left-hand side of the international dateline, and extends eastward across it. You should add this function somewhere in your code: function fixExtent(extent) {
var extents = extent.normalize();
if (extents.length === 1)
return extents[0];
else {
var westExtent, eastExtent;
if (extents[0].xmax > extents[1].xmax) {
westExtent = extents[0];
eastExtent = extents[1];
} else {
westExtent = extents[1];
eastExtent = extents[0];
}
westExtent.xmax += eastExtent.width;
return westExtent;
}
} Then, you would change the call to goTo to be this.view.goTo(fixExtent(extent)).catch(this.catchAbortError);
... View more
01-06-2023
01:08 PM
|
0
|
18
|
2388
|
|
POST
|
The solution described in this post may be what you're looking for.
... View more
01-06-2023
10:17 AM
|
0
|
1
|
917
|
|
POST
|
It looks like in this case, the issue is because the full extent is crossing the international dateline. Therefore, a single extent object will have 'x' values that go beyond the boundaries of what's defined for the coordinate system. You may be able to solve this easily by using Extent.normalize. In that case, the final line would be: this.view.goTo(extent.normalize()).catch(this.catchAbortError); Although this post is from a completely different API, the images used in the post marked as a solution help to illustrate what you're seeing.
... View more
01-06-2023
10:11 AM
|
0
|
20
|
5073
|
|
POST
|
At this point, I'd probably just recommend calculating the extent manually and zooming to that: var extent = null;
for (var i = 0; i < objCoordinates.length; i++) {
//etc...
if (extent === null)
extent = polygon.extent.clone();
else
extent.union(polygon.extent);
}
this.view.goTo(extent).catch(this.catchAbortError);
... View more
01-05-2023
03:46 PM
|
0
|
23
|
5101
|
|
POST
|
Regarding this code: this.view.goTo({
target: this.view.graphics
}).catch(this.catchAbortError); this.view.graphics is a Collection, but the documentation for goTo does not specify that a Collection is supported. I would recommend passing a value specified in the documentation, like an array of Graphics: this.view.goTo(this.view.graphics.toArray()).catch(this.catchAbortError);
... View more
01-05-2023
09:57 AM
|
0
|
25
|
5107
|
|
POST
|
Your implementation will generate a number of UniqueValueRenderers, each with one symbol. However, it seems what you're really trying to do is create a single UniqueValueRenderer with all the symbols. If that's the case, then the code below may solve the problem: $.ajax({
type: "GET",
dataType: "json",
url: "/LocationType/LoadLocationType",
success: function(data) {
var renderer = new UniqueValueRenderer({field:"id});
for (var i = 0; i < data.length; ++i) {
renderer.addUniqueValueInfo({
value: data[i].id,
label: data[i].locationTypeName,
symbol: {
type: "picture-marker",
url: "https://localhost/image/" + data[i].locationTypeImageName,
width: "20px",
height: "20px",
outline: {
color: [255, 255, 255],
width: 1
}
}
});
}
//now do something with the renderer (e.g. add to a layer, etc).
},
error: function () {
alert('Something when wrong');
}
})
... View more
01-04-2023
03:30 PM
|
0
|
1
|
1248
|
|
POST
|
I see the first line in your loop is: var coordinates = objCoordinates[0]; This would definitely throw off your results, and I think you would rather intend: var coordinates = objCoordinates[i];
... View more
01-04-2023
11:16 AM
|
0
|
27
|
5117
|
|
POST
|
The documentation indicates that layers must have unique IDs, so going against that would give unpredictable results. I would recommend adjusting your application so layers have unique IDs.
... View more
01-04-2023
10:11 AM
|
0
|
2
|
2335
|
|
POST
|
Your code is assuming that all layers in your map are FeatureLayers, but that is unlikely. You should therefore check the layer type before trying to execute a query on it. One simple check would be like so: map.allLayers.forEach(layer => {
// Query all layers data
if (typeof layer.queryFeatures == "function") {
layer.queryFeatures(query).then((results) => {
// do something with query results
console.log(results)
}).catch(errorCallback);
}
});
... View more
12-23-2022
08:23 AM
|
1
|
0
|
2097
|
|
POST
|
If that was going to work, you'd have to click exactly on the very same coordinates as the point feature, but that's virtually impossible. Therefore, for point queries, you should use MapView.hitTest instead - as long as you click on the point's symbology it should work. Maybe try something like this: function queryFeaturelayer(geometry) {
if (geometry.type == "point") {
gisView.hitTest(gisView.toScreen(geometry), {include:parcelLayer}).then(function(hitTestResult) {
var graphics = [];
hitTestResult.results.forEach(function(result) {
graphics.push(result.graphic);
});
console.log("Feature count: " + graphics.length);
displayResults({features:graphics});
});
} else {
const parcelQuery = {
spatialRelationship: "intersects",
geometry: geometry,
outFields: ['*'],
returnGeometry: true
};
parcelLayer.queryFeatures(parcelQuery).then((results) => {
console.log("Feature count: " + results.features.length);
displayResults(results);
}).catch((error) => {
console.log(error);
});
}
}
... View more
12-22-2022
07:25 PM
|
0
|
1
|
2893
|
|
POST
|
In order for the applyEdits operation to successfully process the deletes, the objectIdField must be set. Although I suppose you could manually set it, this ordinarily doesn't take place until the layer has loaded. Therefore, I would recommend something like the following change: const featureLayer = new esriJS.FeatureLayer(featureLayerUrl);
featureLayer.on("load", function() {
featureLayer.applyEdits(null, null, [toDelete], (adds, updates, deletes) => {
resolve(deletes);
}, err => {
console.log(err);
debugger
reject(err);
});
}); Waiting for the layer to load before calling applyEdits may also solve the problem you were having in the other thread.
... View more
12-22-2022
09:30 AM
|
2
|
0
|
1012
|
|
POST
|
The documentation for view.open indicates that when the "features" property is set, it will use their popupTemplates to render the content of the popup. Therefore, I believe this is why your title and content are ignored. I think the solution would go something like this: featureLayer.queryFeatures(query).then(function(results) {
results.features.forEach(function(graphic) {
graphic.popupTemplate = {title:"Test",content:"{type_lieu}"};
});
view.popup.open({
features: results.features,
location: evt.result.feature.geometry.centroid
});
});
... View more
12-22-2022
09:14 AM
|
0
|
1
|
1507
|
|
POST
|
Assuming you have an array of layer IDs that are sorted in the order you want, and also with the lowest layer at index 0, it seems to me that you could add a function like this and call it as needed (e.g. after adding a layer, etc): function resetLayerOrder(map, sortedLayerIDs) {
var mapLayerIndex = 0;
sortedLayerIDs.forEach(function(layerID) {
var layer = map.findLayerById(layerID);
if (layer)
map.reorder(layer, mapLayerIndex++);
});
} (This also assumes you're working with version 4.x of the API; see also Map.reorder.)
... View more
12-19-2022
08:49 AM
|
0
|
0
|
2370
|
|
POST
|
In terms of hacks, I think esriRequest.setRequestPreCallback may be your best bet. It allows you to intercept and modify requests before they're sent. I think it's there that you could add the clipping parameter and value.
... View more
12-15-2022
03:18 PM
|
1
|
1
|
1359
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-19-2024 10:37 AM | |
| 1 | 03-31-2026 02:34 PM | |
| 1 | 12-09-2025 09:35 AM | |
| 2 | 12-09-2025 09:06 AM | |
| 1 | 11-26-2025 12:29 PM |