POST
|
No worries, I'll go with the approach I took in the example, thanks for confirming it's acceptable.
... View more
06-21-2017
11:19 AM
|
0
|
0
|
1742
|
POST
|
Interesting approach, I'll keep that in mind. Thanks for confirming my approach.
... View more
06-21-2017
11:14 AM
|
0
|
0
|
1742
|
POST
|
Thanks for the suggestion - are you referring to the LabelClass? If so, the documentation unfortunately says there is no support for labeling in 2D.
... View more
06-21-2017
09:01 AM
|
0
|
2
|
1742
|
POST
|
Hi Anthony, In my case I'm querying an external data source and need to plot the points manually, e.g. in the image where it shows the number 41, I am getting back a single number rather than 41 individual items that would each be added to the map. I'm unsure by looking at these examples you've provided if they would work in my scenario, I'm guessing they are relying on the layer containing the data itself. Can you let me know? Thanks, Alan
... View more
06-20-2017
06:24 PM
|
0
|
1
|
1742
|
POST
|
I'm wanting to show a circle with a number on it that represents the number of items that exist at that point. The best I've come up with is to first add a SimpleMarkerSymbol (the circle) followed by a TextSymbol (the text) at the same coordinates. Is this the right approach or is there some other way to go about doing this? Here is what it looks like plus the code and a JS Bin link. <script>
require([
"esri/Map",
"esri/views/MapView",
"esri/symbols/TextSymbol",
"esri/symbols/SimpleMarkerSymbol",
"esri/Graphic",
"esri/geometry/Point",
"dojo/domReady!"
], function(Map, MapView, TextSymbol, SimpleMarkerSymbol, Graphic, Point) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65]
});
view.then(function() {
var symbol = new TextSymbol({
text: "41",
font: {
size: 14,
family: "monospace"
},
color: "white",
verticalAlignment: "middle"
});
var textGraphic = new Graphic({
symbol: symbol,
geometry: view.extent.center
});
var circle = new SimpleMarkerSymbol({
color: "black",
size: 25
});
var circleGraphic = new Graphic({
symbol: circle,
geometry: view.extent.center
});
view.graphics.add(circleGraphic);
view.graphics.add(textGraphic);
});
});
</script> JS Bin on jsbin.com Thanks, Alan
... View more
06-20-2017
06:03 PM
|
0
|
9
|
3094
|
POST
|
I'm using TypeScript and wondering if there's a better way to await a MapView than what I'm currently doing. The example in the documentation shows how to supply a callback for the then promise when using vanilla JavaScript: var view = new MapView();
view.then(function(){
// This code will execute once the promise is resolved
}); What I'd like to do is use the await keyword to avoid the nested function call. This is the only way I've been able get this to work: let view = new MapView();
await view.then(() => {});
// This code will execute once the promise is resolved Ideally I would be able to write something like this: let view = new MapView();
await view;
// this code will execute after the promise is resolved Although it doesn't compile with this error: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member. Thanks, Alan
... View more
06-20-2017
01:02 PM
|
0
|
1
|
889
|
POST
|
The debounce approach is working beautifully, thanks!
... View more
06-19-2017
01:38 PM
|
0
|
1
|
3326
|
POST
|
I've tried that but the whenFalseOnce callback is getting triggered multiple times. This would have been ideal if it had worked.
... View more
06-19-2017
01:36 PM
|
0
|
0
|
3326
|
POST
|
Hi Robert, Thanks for the suggestion, I've given that a quick try but it doesn't seem to be working reliably. The updating status seems to be changing multiple times throughout the zooming process. constructor(basemap: string = "streets", container: string = "viewDiv", center: number[] = [-104.61, 50.45], zoom: number = 12) {
...
watchUtils.watch(this.view, "zoom", this.onZoomChange);
}
onZoomChange(newValue: number, oldValue: number, propertyName: string, target: MapView) {
console.log(`zoom is ${newValue}`);
if (target.updating) {
console.log("zoom in progress");
}
else {
console.log("finished zoom");
}
} Here's a working approach I've found, any feedback? onZoomChange(newValue: number, oldValue: number, propertyName: string, target: MapView) {
console.log(`zoom is ${newValue}`);
if (newValue % 1 !== 0) {
console.log("zoom in progress");
}
else {
console.log("finished zoom");
}
} Thanks, Alan
... View more
06-19-2017
01:04 PM
|
0
|
6
|
3326
|
POST
|
Hello, I'm trying to detect when a map has been zoomed in or out, and when that is complete to execute a function. I have tried using watchUtils.watch on both the view.zoom and view.extent properties, but am finding that the callbacks get executed too many times. Here's the TypeScript code I'm using, where the console.log statements are getting executed too many times: constructor(basemap: string = "streets", container: string = "viewDiv", center: number[] = [-104.61, 50.45], zoom: number = 12) {
this.map = new Map({
basemap: basemap
});
this.view = new MapView({
container: container,
map: this.map,
center: center,
zoom: zoom
});
watchUtils.watch(this.view, "zoom", function (zoom) { console.log(`zoom is now ${zoom}`) });
watchUtils.watch(this.view, "extent", function (extent) { console.log(`extent is now ${extent}`) });
} Here's what the output looks like in the console: Is there a way to detect the change only when the zoom is complete? Perhaps there's another approach for accomplishing this than watching these properties?
... View more
06-19-2017
11:58 AM
|
0
|
8
|
5461
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|