|
POST
|
Hi Nick, I checked out the project locally, pretty cool To integrate properly in 2D you will have to implement a custom layerview by extending the BaseLayerView2D. See https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-layers-BaseLayerView2D.html Basically you implement the base class and its render function. This function is called at each frame with the current view state as well as a canvas' ContextRendering2D that you can use to draw. Then we compose the canvas with the rest of the webgl content. The base class also gives you information about tiles if you want this kind of info. Cheers Yann
... View more
12-19-2018
02:54 PM
|
0
|
6
|
3921
|
|
POST
|
Hi, This is a normal behavior. Here is an snippet using JS Promise that reproduce the same behavior: Promise.resolve().then(
() => {
throw new Error("throwing in the then() callback")
},
(error) => {
console.error("not catching the error", error);
}
)
.catch(error => {
console.error("catching the error", error);
});
You will see that the error callback won't react to what's happening in the success callback. As a good practice, I never use the error callback, only chain with .catch Promise.resolve().then(
() => {
throw new Error("throwing in the then() callback")
}
)
.catch(error => {
console.error("catching the error", error);
})
Your code snippet would look like: var view = new MapView({
"container": "viewDiv",
"map": map,
"zoom": 7
});
view.when(function(view) {
throw new Error("This error is displayed in the browser console");
})
.catch(function(error) {
console.error(error);
});
Also, make sure to first assign view to the MapView instance. // DON'T
var view = new MapView().when(); // view is a promise
// DO
var view = new MapView(); // view is a MapView
var promise = view.when();
... View more
01-26-2018
08:33 AM
|
1
|
0
|
1015
|
|
POST
|
The reason is that we want to give some buffer between us and the browser to get a chance cancel requests. The implementation of the queuing is rather simple, we need heuristics and also to make use of tileServers to determine how many requests at a single time. > I don't see an easier way to do this without bringing in more of the undocumented API, but I do think it's something that could be exposed to the user without too much trouble in the future. It should just work. Exposing low level configurations like this one is not something we want as it generates more bugs than improves the experience.
... View more
12-12-2017
03:44 PM
|
1
|
0
|
1799
|
|
POST
|
Hi Yang, You don't really need to watch both properties. You can just watch for `stationary` and keep some info around: function whenZoomChange(view, callback) {
let oldScale;
view.watch('stationary', (isStationary) => {
if (!isStationary) {
oldScale = view.scale;
}
else {
if (oldScale !== view.scale) {
callback();
}
}
});
});
On the academic discussion, we made the choice to favor watching properties over events as it gives more control over events. - Events don't give us access to the current state of the emitter. If your code gets a mapview object and it's already zooming, without a property expressing that you cannot know it, while `stationary` gives out this information. - Having events AND properties just blows up the API with redundant information.
... View more
12-12-2017
02:42 PM
|
1
|
1
|
702
|
|
POST
|
Hi Chris, This is an area we will improve. We indeed don't yet vary the concurrency based on the service capabilities. This will come. The hack is ok as a workaround for now as long as you re-apply it in upcoming 4.6. Cheers Yann
... View more
12-12-2017
11:01 AM
|
1
|
0
|
1799
|
|
POST
|
The BaseElevationLayer indeed defines default values for fullExtent, spatialReference and tileInfo. To create your custom layer in a different SR or tiling scheme, in the loading chain you can load the original layer and then copy the values to the instance of the custom layer. I modified the layer from ArcGIS API for JavaScript Sandbox to do this: var ExaggeratedElevationLayer = BaseElevationLayer.createSubclass({
// Add an exaggeration property whose value will be used
// to multiply the elevations at each tile by a specified
// factor. In this case terrain will render 100x the actual elevation.
properties: {
exaggeration: 100
},
// The load() method is called when the layer is added to the map
// prior to it being rendered in the view.
load: function() {
this._elevation = new ElevationLayer({
url: "//elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
});
// wait for the elevation layer to load before resolving load()
this.addResolvingPromise(this._elevation.load().then(function() {
this.fullExtent = this._elevation.fullExtent;
this.spatialReference = this._elevation.spatialReference;
this.tileInfo = this._elevation.tileInfo;
}.bind(this)));
},
// Fetches the tile(s) visible in the view
fetchTile: function(level, row, col) {
// calls fetchTile() on the elevationlayer for the tiles
// visible in the view
return this._elevation.fetchTile(level, row, col)
.then(function(data) {
var exaggeration = this.exaggeration;
// `data` is an object that contains the
// the width of the tile in pixels,
// the height of the tile in pixels,
// and the values of each pixel
data.values.forEach(function(value, index, values) {
// each value represents an elevation sample for the
// given pixel position in the tile. Multiply this
// by the exaggeration value
values[index] = value * exaggeration;
});
return data;
}.bind(this));
}
}); The part that copies: // wait for the elevation layer to load before resolving load()
this.addResolvingPromise(this._elevation.load().then(function() {
this.fullExtent = this._elevation.fullExtent;
this.spatialReference = this._elevation.spatialReference;
this.tileInfo = this._elevation.tileInfo;
}.bind(this)));
... View more
10-02-2017
10:30 AM
|
2
|
0
|
2048
|
|
POST
|
Hello Willem, You can use directly the queryFeatures method on the Sublayer. Sublayer | API Reference | ArcGIS API for JavaScript 4.1 Indeed we had remove the IdentifyTask from 4.1, this slipped through the release notes. Sorry about the inconvenience. We removed it because this class was using the old way of defining definitionExpressions, dynamic layers, etc... for the sublayers of the MapImageLayer. Now you can directly invoke queryFeatures which saves a lot of time. We are still considering if we reintroduce the IdentifyTask (as well as FindTask) to a later release or not. We are hesitant because the IdentifyTask is really tied to 2D and would be really hard to configure in for a 3D view. Of course we could say it's recommended for 2D only but we don't want you to build a 2D experience that you could port to 3D.
... View more
10-10-2016
09:48 AM
|
2
|
1
|
2289
|
|
POST
|
Hi Stéphane, We are looking into having proper touch support in 4.1. In the meantime you can work around the issue by stopping the event to propagate to the browser: view.surface.addEventListener("touchmove", function(event) {
event.preventDefault();
})
... View more
07-18-2016
04:44 PM
|
1
|
0
|
1516
|
|
POST
|
Hi, We don't have a proper API for gestures at the moment but you can intercept and stop the event like this: view.surface.addEventListener("wheel", function(event) {
event.stopImmediatePropagation();
}, true);
... View more
06-01-2016
05:13 PM
|
3
|
1
|
1410
|
|
POST
|
I create a temporary workaround here: JS Bin - Collaborative JavaScript Debugging <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>MapView</title>
<link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/4.0beta3/esri/css/main.css">
<style type="text/css" media="screen">
html, body, #mapDiv {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
</style>
<script src="//js.arcgis.com/4.0beta3/"></script>
<script>
var map, view;
require([
"esri/Map",
"esri/Basemap",
"esri/layers/Layer",
"esri/layers/ArcGISDynamicLayer",
"esri/layers/support/TileInfo",
"esri/layers/support/LOD",
"esri/geometry/Point",
"esri/geometry/Extent",
"esri/geometry/SpatialReference",
"esri/views/MapView",
"dojo/domReady!"
], function (
Map, Basemap,
Layer, ArcGISDynamicLayer,
TileInfo, LOD,
Point, Extent, SpatialReference,
MapView
) {
map = new Map({
layers: [
new ArcGISDynamicLayer({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer"
})
],
basemap: new Basemap({
baseLayers: [
new Layer({
viewModulePaths: {},
initialExtent: new Extent(-20037508.342787, -20037508.342780, 20037508.342780, 20037508.342787, SpatialReference.WebMercator),
tileInfo: new TileInfo({
rows: 256,
cols: 256,
dpi: 96,
format: "PNG8",
compressionQuality: 0,
origin: new Point({
x: -20037508.342787,
y: 20037508.342787,
spatialReference: SpatialReference.WebMercator
}),
spatialReference: SpatialReference.WebMercator,
lods: [
new LOD({ level: 0, scale: 591657527.591555, resolution: 156543.033928 }),
new LOD({ level: 1, scale: 295828763.795777, resolution: 78271.5169639999 }),
new LOD({ level: 2, scale: 147914381.897889, resolution: 39135.7584820001 }),
new LOD({ level: 3, scale: 73957190.948944, resolution: 19567.8792409999 }),
new LOD({ level: 4, scale: 36978595.474472, resolution: 9783.93962049996 }),
new LOD({ level: 5, scale: 18489297.737236, resolution: 4891.96981024998 }),
new LOD({ level: 6, scale: 9244648.868618, resolution: 2445.98490512499 }),
new LOD({ level: 7, scale: 4622324.434309, resolution: 1222.99245256249 }),
new LOD({ level: 8, scale: 2311162.217155, resolution: 611.49622628138 }),
new LOD({ level: 9, scale: 1155581.108577, resolution: 305.748113140558 }),
new LOD({ level: 10, scale: 577790.554289, resolution: 152.874056570411 }),
new LOD({ level: 11, scale: 288895.277144, resolution: 76.4370282850732 }),
new LOD({ level: 12, scale: 144447.638572, resolution: 38.2185141425366 }),
new LOD({ level: 13, scale: 72223.819286, resolution: 19.1092570712683 }),
new LOD({ level: 14, scale: 36111.909643, resolution: 9.55462853563415 }),
new LOD({ level: 15, scale: 18055.954822, resolution: 4.77731426794937 }),
new LOD({ level: 16, scale: 9027.977411, resolution: 2.38865713397468 }),
new LOD({ level: 17, scale: 4513.988705, resolution: 1.19432856685505 }),
new LOD({ level: 18, scale: 2256.994353, resolution: 0.597164283559817 }),
new LOD({ level: 19, scale: 1128.497176, resolution: 0.298582141647617 })
]
})
})
]
})
});
view = new MapView({
container: "mapDiv",
center: [-100, 40],
zoom: 4,
map: map
});
map.layers.getItemAt(0).then(function(layer) {
view.extent = layer.fullExtent;
})
});
</script>
</head>
<body>
<div id="mapDiv">
</div>
</body>
</html>
... View more
02-17-2016
09:53 AM
|
1
|
1
|
1896
|
|
POST
|
Hi Rex, you can totally do this. I set up a example here: Chaining animations var cameras = [
{
"position": {
"x": 860866.9791700585,
"y": 5776206.000594208,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"z": 5182.999999999069
},
"heading": 270.0000000089171,
"tilt": 79.9999999867539
},
{
"position": {
"x": 852082.9255940468,
"y": 5784990.056948395,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"z": 5182.999999997206
},
"heading": 180,
"tilt": 79.9999999681663
},
{
"position": {
"x": 843580.3118266261,
"y": 5776487.440662808,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"z": 5182.999999997206
},
"heading": 90.00000000865207,
"tilt": 79.99999998165575
},
{
"position": {
"x": 852039.3825317192,
"y": 5767378.401137406,
"spatialReference": {
"wkid": 102100
},
"z": 5182.999999999069
},
"heading": 359.99999914622634,
"tilt": 79.99999998987897
}
].map(Camera.fromJSON);
var delay = function(delay) {
var deferred = new Deferred();
setTimeout(function() {
deferred.resolve();
});
return deferred.promise;
};
window.animateCamera = function() {
var timeline = cameras.concat();
var next = function() {
var camera = timeline.shift();
if (camera) {
return view.animateTo(camera).then(next);
}
}
var animation = promiseUtils.resolve()
.then(function() { return delay(500); })
.then(next);
animation.then(function() {
console.log("animation finished done");
});
};
var logProperty = function(newValue, oldValue, prop) {
var oldValueString = (oldValue && typeof oldValue === "object") ? "[object]" : oldValue;
var newValueString = (newValue && typeof newValue === "object") ? "[object]" : newValue;
console.log(prop + " changed from " + oldValueString + " to " + newValueString);
};
view.watch("stationary, animation, interacting", logProperty)
Have fun!
... View more
12-10-2015
11:24 AM
|
2
|
0
|
770
|
|
POST
|
KMLLayer is not being removed, but it's not yet implemented.
... View more
12-01-2015
02:35 PM
|
1
|
0
|
1400
|
|
POST
|
Hi Bhavin, For my estimate, issue affects all API versions > 2.6 This issue is due to Chrome not properly handling large scaled images. Issue 437904 - chromium - Applying opacity to element with big scale transform freezes the page - An open-source proj… I'm working on working around that issue internally for 3.15.
... View more
10-20-2015
03:40 PM
|
1
|
1
|
1630
|
|
POST
|
Hi, The issue is logged in the API. I'm looking into it. Unfortunately, it's not the first time Chrome introduces those problems.
... View more
10-20-2015
10:19 AM
|
0
|
6
|
1977
|
|
POST
|
Hi, View constraints are now into a dedicated object. MapView | API Reference | ArcGIS API for JavaScript
... View more
09-26-2015
10:59 PM
|
2
|
1
|
642
|
| Title | Kudos | Posted |
|---|---|---|
| 9 | 06-27-2025 02:06 PM | |
| 1 | 12-05-2024 10:05 AM | |
| 1 | 12-05-2024 09:53 AM | |
| 1 | 12-15-2022 09:20 AM | |
| 3 | 08-26-2020 04:24 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-09-2025
09:01 AM
|