|
POST
|
One trick you can do is to make sure your query's where clause is always unique. A common technique to return all features (and it is what it is) is to set the where clause to "1=1". However, you could substitute any number into that. To guarantee a unique number every time, which would defeat the browser's cache, you could use something like Date.now() every time. For example, if your Query object had no where value, you'd put: var now = Date.now().toString();
query.where = now + "=" + now; Otherwise, if your Query already had a where value, you'd put: var now = Date.now().toString();
query.where = "(" + query.where + ") AND " + now + "=" + now;
... View more
10-21-2022
05:17 PM
|
0
|
0
|
1479
|
|
POST
|
Technically, you'd be able to do this by calling MapView.emit, and passing as close to an event object as you can. This could be problematic though, since simulating the "stopPropagation" function and the "native" property could present certain inconsistencies. Probably the easiest approach would be something like this: function simulateClick(mapView, mapPoint) {
var screenPoint = mapView.toScreen(mapPoint);
mapView.emit("click", {
mapPoint: mapPoint,
x: screenPoint.x,
y: screenPoint.y,
button: 0,
buttons: 0,
type: "click",
stopPropagation: function() { },
timestamp: Date.now(),
native: {}
});
} As a disclaimer, I would never do this in practice, or recommend it either...I'm just answering the question as asked.
... View more
10-21-2022
05:03 PM
|
1
|
2
|
3802
|
|
POST
|
I'm afraid my time available to help is very limited. The best I might offer at this point is what I would try next if it were me. I would avoid specifying parameters in the constructor for TileInfo since it's not well documented (and maybe even the same for WMSTileInfo). For example, instead of something like: var tileInfo = new TileInfo({
propertyName1: propertValue1,
propertyName2: propertValue2
}); maybe something like: var tileInfo = new TileInfo();
tileInfo.propertyName1 = tileInfo.propertyValue1;
tileInfo.propertyName2 = tileInfo.propertyValue2; In doing that, be sure to use fully instantiated objects as well. For example, when specifying the origin property, I recommend using an Point object instance with its spatialReference specified. The way you presently have it as an object literal, I'm not sure what the API would do, and since there's no spatialReference specified, it would default to WGS 84 (4326), but I can tell you're not trying to use that. Another example, is that in the "format" property for TileInfo, the documentation for that property accepts the values "png8", "png24", "png32", and "jpg", but you have "image/png". I hope that helps...I apologize for not being able to do more.
... View more
10-17-2022
11:49 AM
|
0
|
0
|
4173
|
|
POST
|
I don't think there's a documented way to automate this, but the user can hold the Shift key down while drawing with the rectangle tool, and it will force a square. This can be confirmed by using the Shift key in combination with the "Draw a rectangle" tool in this sample.
... View more
10-11-2022
03:40 PM
|
0
|
1
|
891
|
|
POST
|
I think the first problem is that you shouldn't specify the query string in the URL as seen on line 1. Instead, it should just be url = "https://wxs.ign.fr/parcellaire/geoportail/wmts"; You might also consider the documentation in the constructor for the resourceInfo object. When using WMTS layers, I've preferred specifying the necessary resourceInfo properties up front so that the GetCapabilities request can be bypassed entirely, and the application can just go immediately to rendering the tiles. The necessary information to specify within resourceInfo can be gathered manually from the contents of the GetCapabilities response.
... View more
10-11-2022
11:39 AM
|
1
|
0
|
4202
|
|
POST
|
The abbreviated setup below is probably along the lines of what you're looking for: var queryTask;
var queryObj;
require(["esri/rest/query/executeQueryJSON","esri/rest/support/Query"], function(QueryTask, Query) {
queryTask = QueryTask;
queryObj = new Query();
//other stuff
});
function runPolygonQuery(qIdx, qErr) {
//other stuff
queryTask.executeQueryJSON(sQryUrl+"/" + qIdx, queryObj);
)
... View more
10-06-2022
09:39 AM
|
0
|
0
|
1920
|
|
POST
|
Have you tried specifying the "x" and "y" properties instead of "latitude" and "longitude"? The error message suggests this might solve the problem. For example: geometry: { type: "point", x: location.lon, y: location.lat }, The default spatial reference when not explicitly specified is WGS 84, so I would expect this to work.
... View more
10-03-2022
02:15 PM
|
0
|
0
|
2669
|
|
POST
|
One problem I see right away is that MapView isn't in the esri/widgets "namespace"...instead, it should be "esri/views/MapView".
... View more
09-23-2022
09:26 AM
|
1
|
0
|
4017
|
|
POST
|
Maybe try using "https" in the URL instead of "http"...
... View more
09-23-2022
09:17 AM
|
0
|
1
|
2256
|
|
POST
|
The issue you're running into is the same underlying issue discussed here: the 3.x API can have problems with tiled layers when the first layer added to the map is not tiled. The solution is to define the map's tiling info up front. Try this instead, which would replace your current call to "require": require([
"esri/map","esri/SpatialReference", "esri/geometry/Extent", "esri/layers/WMSLayer", "esri/layers/WMSLayerInfo", "esri/layers/WMTSLayer", "esri/layers/WMTSLayerInfo",
"esri/config", "esri/layers/TileInfo", "esri/geometry/Point",
"dojo/domReady!"
], function(
Map, SpatialReference, Extent, WMSLayer,WMSLayerInfo, WMTSLayer, WMTSLayerInfo,
esriConfig, TileInfo, Point
) {
var extent3857 = new Extent({
xmin: 612056.7798435382,
ymin: 5682778.707431033,
xmax: 822811.5409472634,
ymax: 5780363.363667572,
spatialReference: { wkid: 102100, latestWkid: 3857 }
});
var extent4326 = new Extent({
xmin: 5.7238,
ymin: 45.6390,
xmax: 5.984802,
ymax: 45.828799,
spatialReference: { wkid: 4326 }
});
esriConfig.defaults.io.proxyUrl = "/AP_voirie/web/kernel/proxy/proxy.ashx";
map = new Map("map", {
extent:extent3857,//pseudo mercator,
zoom: 13
});
var tileInfo = new TileInfo({
dpi: 96,
height: 256,
lods: [
{
level: 0,
resolution: 156543.033928,
scale: 591657527.591555
},
{
level: 1,
resolution: 78271.5169639999,
scale: 295828763.795777
},
{
level: 2,
resolution: 39135.7584820001,
scale: 147914381.897889
},
{
level: 3,
resolution: 19567.8792409999,
scale: 73957190.948944
},
{
level: 4,
resolution: 9783.93962049996,
scale: 36978595.474472
},
{
level: 5,
resolution: 4891.96981024998,
scale: 18489297.737236
},
{
level: 6,
resolution: 2445.98490512499,
scale: 9244648.868618
},
{
level: 7,
resolution: 1222.99245256249,
scale: 4622324.434309
},
{
level: 8,
resolution: 611.49622628138,
scale: 2311162.217155
},
{
level: 9,
resolution: 305.748113140558,
scale: 1155581.108577
},
{
level: 10,
resolution: 152.874056570411,
scale: 577790.554289
},
{
level: 11,
resolution: 76.4370282850732,
scale: 288895.277144
},
{
level: 12,
resolution: 38.2185141425366,
scale: 144447.638572
},
{
level: 13,
resolution: 19.1092570712683,
scale: 72223.819286
},
{
level: 14,
resolution: 9.55462853563415,
scale: 36111.909643
},
{
level: 15,
resolution: 4.77731426794937,
scale: 18055.954822
},
{
level: 16,
resolution: 2.38865713397468,
scale: 9027.977411
},
{
level: 17,
resolution: 1.19432856685505,
scale: 4513.988705
},
{
level: 18,
resolution: 0.59716428355981721,
scale: 2256.994353
},
{
level: 19,
resolution: 0.29858214164761665,
scale: 1128.4971760000001
},
{
level: 20,
resolution: 0.1492910708899543,
scale: 564.248588
},
{
level: 21,
resolution: 0.0746455354449772,
scale: 282.124294
},
{
level: 22,
resolution: 0.0373227677224886,
scale: 141.062147
},
{
level: 23,
resolution: 0.0186613838612443,
scale: 70.5310735
},
{
level: 24,
resolution: 0.0093306919306222,
scale: 35.26553675
}
],
origin: new Point(-20037508.342787, 20037508.342787, new SpatialReference(3857)),
spatialReference: new SpatialReference(3857),
width: 256
});
map._params.tileInfo = tileInfo;
map.__tileInfo = tileInfo;
dojo.connect(map, "onLoad", function ()
{
console.log("maponload");
//ignWmsLayer.spatialReference = { wkid: 102100, latestWkid: 3857 } ;
//ignWmtsLayer.spatialReference = { wkid: 102100, latestWkid: 3857 } ;
//ignWmsLayer.spatialReferences[0] = 3857;
console.log(ignWmsLayer.spatialReferences);
console.log("spatialReference esriLayer : " , esriLayer.spatialReference);
console.log("spatialReference ignwms : " , ignWmsLayer.spatialReference);
console.log("spatialReference ignWmtsLayer : " , ignWmtsLayer.spatialReference);
});
var aLayers = [];
// ESRI basemaps
var strEsriUrl = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer";
esriLayer = new esri.layers.ArcGISTiledMapServiceLayer(strEsriUrl);
// IGN basemaps
// WMS
// https://wxs.ign.fr/cartes/geoportail/r/wms?request=GetCapabilities&service=WMS
// Premier systeme de coordonnées de référence : CRS:84 comment le changer au chargement
var strIgnWmsUrl = "https://wxs.ign.fr/cartes/geoportail/r/wms";
/*
Test avec Layer info
var WMSLayerInfo1 = new esri.layers.WMSLayerInfo({
name: 'SCANREG_PYR-JPEG_WLD_WM',
title: 'SCANREG_PYR-JPEG_WLD_WM',
spatialReferences : [3857]
});
var resourcesInfo = {
layerInfos: [WMSLayerInfo1],
spatialReferences : [3857],
extent: extent3857
};
ignWmsLayer = new esri.layers.WMSLayer(strIgnWmsUrl, {
format: "jpeg",
minScale: 100000000,
maxScale: 200,
resourceInfo : resourcesInfo,
visibleLayers: ["SCANREG_PYR-JPEG_WLD_WM"],
transparent: true,
id: "WMS ScanRegion"
});
*/
ignWmsLayer = new esri.layers.WMSLayer(strIgnWmsUrl, {
format: "jpeg",
minScale: 100000000,
maxScale: 200,
visibleLayers: ["SCANREG_PYR-JPEG_WLD_WM"],
transparent: true,
id: "WMS ScanRegion"
});
// WMTS
// https://wxs.ign.fr/ortho/geoportail/wmts?request=GetCapabilities&service=WMTS&version=1.0.0
var strIgnWmtsUrl = "https://wxs.ign.fr/ortho/geoportail/wmts";
var layerInfo = new esri.layers.WMTSLayerInfo({
identifier: "ORTHOIMAGERY.ORTHOPHOTOS",
tileMatrixSet: "PM",
format: "jpeg"
});
var ignOptions = {
serviceMode: "KVP",
minScale: 100000000,
maxScale: 200,
layerInfo: layerInfo
};
ignWmtsLayer = new esri.layers.WMTSLayer(strIgnWmtsUrl, ignOptions);
// Add layers to array
// esri first one => OK it works
/*aLayers.push(esriLayer);
aLayers.push(ignWmtsLayer);
aLayers.push(ignWmsLayer);*/
// wmts first one => OK it works
/*aLayers.push(ignWmtsLayer);
aLayers.push(ignWmsLayer);
aLayers.push(esriLayer);*/
// wms first one => NO it doesn't work => how change CRS WMS in spatialreferences ?
aLayers.push(ignWmsLayer);
aLayers.push(ignWmtsLayer);
aLayers.push(esriLayer);
// setVisibility first layer
for (let index = 0; index < aLayers.length; index++) {
let layer = aLayers[index];
if (index == 0) layer.setVisibility(true);
else layer.setVisibility(false);
}
// Add basemaps layers
map.addLayers(aLayers);
});
... View more
09-14-2022
11:02 AM
|
0
|
1
|
1703
|
|
POST
|
The code works as it should. To verify, replace lines 43-45 of this sample with the code above, then click the Refresh item at the top right of the page. Afterwards, clicking an item in the gallery will then produce an alert as expected, and also change the basemap.
... View more
09-13-2022
09:06 AM
|
0
|
1
|
2933
|
|
POST
|
The code you have indicates you're using version 4.x of the API, but the documentation you referred to is for 3.x, which doesn't correspond. The 4.x BasemapGallery does not support the kind of event you're looking for, at least according to the documentation anyways, but you shouldn't let that stop you. With a glance at the source code for the BasemapGallery widget, it can be seen that the following hack will do what you're asking: const basemapGallery = new BasemapGallery({
view: view,
container: document.createElement("div")
});
basemapGallery._originalHandleClick = basemapGallery._handleClick;
basemapGallery._handleClick = function(evt) {
var basemapGalleryItem = evt.currentTarget["data-item"];
alert("You selected the basemap with title = [" + basemapGalleryItem.get("basemap.title") + "] and id = [" + basemapGalleryItem.get("basemap.id") + "]");
this._originalHandleClick(evt);
}; See also the reference for BasemapGalleryItem for further information.
... View more
09-12-2022
11:02 AM
|
0
|
4
|
2962
|
|
POST
|
I suppose there are many ways, but here's a simple example. You would replace lines 181-192 (where the Grid is created) with the following, which uses a simple field name to field alias map: grid = new Grid(
{
columns: Object.keys(rows[0]).map(function (fieldName) {
var fieldAliases = {
"NAME": "City",
"SUM_POPULATION": "Sum Population"
};
return {
label: fieldAliases[fieldName] || fieldName,
field: fieldName,
sortable: true
};
})
},
gridDiv
);
... View more
09-07-2022
04:11 PM
|
0
|
1
|
1396
|
|
POST
|
This is practically identical to this post. Have you tried the solution proposed there?
... View more
09-06-2022
11:03 AM
|
0
|
1
|
1507
|
| 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 |