|
POST
|
It seems to me you could use esriConfig.request.interceptors to do this. If so, it would look something like: require(["esri/config", function(esriConfig) {
esriConfig.request.interceptors.push({
urls: "https://fsapps.nwcg.gov/afm/data/kml/images/",
before: function(params) {
params.url = "https://myServer/images" + params.url.substr(params.url.lastIndexOf("/"));
return null;
}
});
});
... View more
02-14-2023
12:13 PM
|
0
|
1
|
1874
|
|
POST
|
When instantiating the Search widget, set locationEnabled to false: const searchWidget = new Search({
locationEnabled: false,
view: view
});
... View more
02-01-2023
05:12 PM
|
1
|
0
|
1172
|
|
POST
|
This might do what you're looking for: sketch.viewModel.polylineSymbol = {
type: "simple-line", //autocasts as new SimpleLineSymbol()
color: "red",
width: "4px",
style: "solid"
};
... View more
02-01-2023
09:59 AM
|
0
|
1
|
1880
|
|
POST
|
This appears to work: const measurement = new Measurement({
areaUnit: "hectares",
linearUnit: "kilometers"
});
measurement.viewModel.watch("activeViewModel", function(newValue, oldValue, propertyName, target) {
if (newValue) {
switch (newValue.declaredClass) {
case "esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel":
case "esri.widgets.AreaMeasurement2D.AreaMeasurement2DViewModel":
newValue.unitOptions = ["square-millimeters","square-centimeters","square-decimeters","square-meters","square-kilometers","ares","hectares"];
break;
case "esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel":
case "esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DViewModel":
newValue.unitOptions = ["millimeters","centimeters","decimeters","meters","kilometers"];
break;
}
}
});
... View more
02-01-2023
09:51 AM
|
0
|
0
|
883
|
|
POST
|
Yes, in version 4.14, ESRI added the HTML sanitizer which, among other things, prevents you from adding event handlers in your popup content. See the final breaking change listed here. Fortunately, if you prefer to decide for yourself what is and isn't permissible in your applications, it's fairly easy to bypass. You'd just need to add the following somewhere near where your application starts up. require(["esri/widgets/support/widgetUtils"], function(widgetUtils) {
var sanitize = widgetUtils.renderingSanitizer.sanitize;
widgetUtils.renderingSanitizer.sanitize = function(b, c) {
return ((typeof b == "string") ? b : sanitize.call(this, b, c));
};
});
... View more
01-30-2023
09:03 AM
|
1
|
2
|
4084
|
|
POST
|
The 3.x "extent-change" event will fire when the user pans the map, but your 4.x solution will not. Is that what you intend?
... View more
01-27-2023
09:06 AM
|
0
|
1
|
2546
|
|
POST
|
I haven't used OAuth, so can't answer your questions directly. What I can tell you, though, is that the FeatureLayer constructor strips off the query string from the URL. To include query string parameters that go along with the service requests, you'll need to use customParameters instead. For example: const layer = new FeatureLayer({
url: "https://server/arcgis/serviceName/FeatureServer/0",
customParameters: {
token: "CODE_FROM_OATH"
}
}); This would work until the token expires, and then the layer would stop working unless you refresh the token. Perhaps a better solution would be to make use of IdentityManager.registerToken instead. This would automatically append the token to any service requests from the matching server path.
... View more
01-26-2023
10:01 AM
|
0
|
0
|
1023
|
|
POST
|
As @UndralBatsukh was basically saying, WebTileLayer doesn't natively support this tiling scheme. However, you can override the logic that generates the URL from the level, row, and column values so that the generated URLs do match that particular scheme: const layer = new WebTileLayer({
urlTemplate: "https://cdn.govmap.gov.il/LPD0BBK2022/L{level}/R{row}/C{col}.jpg"
});
layer._addLeadingZeros = function(number, desiredLength) {
var str = number.toString();
while (str.length < desiredLength)
str = "0" + str;
return str;
};
layer.getTileUrl = function(level, row, col) {
var lodIndex = level - this.tileInfo.lods[0].level;
var url;
if ((lodIndex >= 0) && (lodIndex < this.tileInfo.lods.length)) {
url = this.urlTemplate.replace(/\$\{level\}/g, this._addLeadingZeros(this.levelValues[level], 2));
url = url.replace(/\$\{col\}/g, this._addLeadingZeros(col.toString(16), 8));
url = url.replace(/\$\{row\}/g, this._addLeadingZeros(row.toString(16), 8));
} else
url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="; //one transparent pixel
return url;
};
... View more
01-25-2023
09:59 AM
|
2
|
4
|
3364
|
|
POST
|
The documentation for the Sublayer.renderer property seems to suggest that the property only exists for the purpose of overriding symbology, and thus doesn't contain the default symbology. This makes sense since the service information used to load your MapImageLayer doesn't contain sublayer renderer information. For that, you have to look at the information from the individual layers (e.g. layer 0). Therefore, I suppose you have two options for your legend. You can retrieve the information for each sublayer manually, or you could retrieve the layer's legend information and use that instead. It doesn't contain the renderer information, but does contain the swatches you could put in your legend.
... View more
01-24-2023
01:26 PM
|
1
|
0
|
2041
|
|
POST
|
When migrating to 4.x, I found it best to replace this by watching the MapView.stationary property, in which case yours would translate to something like: mapView.watch("stationary", this.myFunction.bind(this)); and elsewhere, something like: myFunction: function(newValue, oldValue, propertyName, target) {
if (newValue) {
var extent = target.extent;
//etc
}
}
... View more
01-23-2023
11:10 AM
|
2
|
3
|
2589
|
|
POST
|
In the Print widget sample, if I add the following within the style tag, the "Map only" tab disappears: .esri-print__layout-tab[data-tab-id="mapOnlyTab"] {
visibility: hidden;
} The same should work if you add it somewhere in your own CSS.
... View more
01-19-2023
12:24 PM
|
1
|
0
|
1101
|
|
POST
|
In this case, you may have to use a function to define your PopupTemplate content. If you did, it might look something like this: function getPopupContent(feature) {
return "<table><tr><td>Pattern:</td><td>" + feature.graphic.attributes.pattern + "</td></tr>" +
"<tr><td>In Transport Position?</td><td>" + feature.graphic.attributes.is_in_transport_position + "</td></tr>" +
"<tr><td>Device Type:</td><td>" + feature.graphic.attributes.core_details.device_type + "</td></tr></table>";
}
var popupTemplate = new PopupTemplate({
title: "My Title",
content: getPopupContent
});
var layer = new GeoJSONLayer({
url: myURL,
popupTemplate: popupTemplate
});
... View more
01-18-2023
10:15 AM
|
2
|
1
|
5434
|
|
POST
|
This isn't pretty, but it will force the queries (and therefore the URLs that access the service) to be unique each time they're sent: newLayer.on("load", () => {
theMap.addLayer(newLayer);
var execute = newLayer._task.execute;
newLayer._task.execute = function(query) {
var now = Date.now().toString();
if ((typeof query.where != "string") || (query.where.trim() === ""))
query.where = now + "=" + now;
else
query.where = "(" + query.where + ") AND " + now + "=" + now;
var args = [];
for (var x = 0; x < arguments.length; x++)
args[x] = arguments[x];
return execute.apply(this, args);
};
});
... View more
01-18-2023
09:28 AM
|
1
|
1
|
2168
|
|
POST
|
I'm not certain if you're saying it doesn't zoom out far enough, or it zooms in closer than it should. In either case, it's possible to make the extent larger or smaller with expand. Supplying a decimal number greater than 1 will make the extent larger; supplying a decimal number between 0 and 1 will make it smaller.
... View more
01-13-2023
03:43 PM
|
0
|
2
|
2628
|
|
POST
|
Although I don't think labelingInfo is one of them, I've run into various situations using the API where an "outer" object (in this case, the layer) doesn't notice a change to an "inner" object's properties when reusing the same object. I suppose it's a little difficult to explain. If that's the kind of thing going on though, you may be able to get around it by using clone: layerDataSource.layer.labelingInfo = [labelInfo.clone()];
... View more
01-13-2023
10:49 AM
|
0
|
0
|
1016
|
| 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 |