|
POST
|
This isn't a big deal for simple popup contents, but if I have a 3rd party javascript library working in the popup, it breaks because the element is removed/reinserted. Could you go into more detail about this? I can add an event listener to the node that gets inserted and that event listener will remain active after you pan the map around. It's the same node. I'm not sure why the content node is removed and then re-inserted as the map is panned. This could be a bug or there might be a good reason for it. The simplest workaround I can think of is just to add a setTimeout(()=>node.classList.remove('animated', 'fadeIn'), 1000) to your function. 1000 because the duration of the animation is 1000.
... View more
10-10-2017
09:30 AM
|
0
|
5
|
1639
|
|
POST
|
Features in a feature layer are fetched using the query function on a feature service, which is documented here: ArcGIS REST API The controller is in charge of determining when to send those queries, besides the first query, which is sent before the controller is instantiated. The controller watches its extent property and the layer's definition expression for changes, and it sends a new query when a change occurs. This is why changing the extent property on the controller or changing the definition expression causes new features to be fetched. If you need to set this process up for all feature layers, you might try something like this: view.watch('stationary', isStationary => {
if (isStationary){
view.layerViews.forEach(lv => {
if (lv.layer.type === 'feature'){
lv.controller.extent = view.extent);
}
})
}
}); I think that will catch group layers. In general, there's one layerView for each layer. The layer itself represents the reference to some back-end resource (or sometimes a front-end resource) while the layerView contains logic and information about how the layer is actually displayed in the view.
... View more
10-10-2017
06:06 AM
|
1
|
0
|
1779
|
|
POST
|
Can you show an example sceneLayer to test this? It may be that, in general, sceneLayers features don't send their attributes to the client.
... View more
10-10-2017
05:40 AM
|
0
|
1
|
3532
|
|
POST
|
You might try something like this for 3D: view.watch('stationary', isStationary => {
if (isStationary){
let lv = view.layerViews.find(lv => lv.layer === featureLayer);
if (lv){
lv.controller.extent = view.extent;
}
}
}); For 2D, this becomes: view.watch('stationary', isStationary => {
if (isStationary){
let lv = view.layerViews.find(lv => lv.layer === featureLayer);
if (lv){
lv.controller.activeController.extent = view.extent;
}
}
}); This should cause your layer to re-query using a filter based on the extent of the view.
... View more
10-09-2017
10:16 AM
|
1
|
2
|
1779
|
|
POST
|
One option may be to use a map server instead of a feature server, so an image is served up, rather than features. I understand this may not be ideal, but I think there are likely performance limits on what can be displayed in 3D at the moment. I don't know if this is documented anywhere, but the scene viewer in portal will not allow you to add layers with more than 2000 features. My understanding is that this is an area of the API that is being worked on.
... View more
10-09-2017
06:51 AM
|
1
|
4
|
1779
|
|
POST
|
An extent or a rectangle? The difference is that an extent will always be oriented based on the surface of the world, whereas a rectangle could be oriented however you like. To draw an extent, you can do something simple like this (click and drag to draw): JS Bin - Collaborative JavaScript Debugging I imagine extents will be added to the drawing tools at some point.
... View more
10-09-2017
06:37 AM
|
3
|
3
|
2778
|
|
POST
|
In my experience the best way to approach this is to manually add the KML as a portal item using the Add Item option from My Contents and use your browser's dev tools to look at the request that gets sent (chrome has a preserve log option to make sure the network log keeps the request). You can use this request as a template for what your request has to do. That aside, here's some code I've used to upload to upload files as portal items using esri/request: // user is a portalUser.
// fileList is an array of files.
// tags is an array of strings
function addFileaAsPortalItem(user, fileList, tags){
const file = fileList[0];
let form = new FormData();
form.append('file',file);
form.append("f", "json");
form.append("title", file.name);
form.append("name", file.name);
form.append("type",'KML');
form.append("token", <server token>);
form.append("filename", file.name);
form.append("tags", tags.join());
return esriRequest(`${user.userContentUrl}/addItem`,{
method: 'post',
query: form
});
} I'm not sure if this will fail when the file is too large. I've used it to upload images, kml, text documents, and more. It also may be a good idea to use esri/request for this, as opposed to the fetch api.
... View more
10-09-2017
06:19 AM
|
3
|
1
|
2911
|
|
POST
|
I haven't used bower or npm to get the API, I would recommend just downloading the source from here and following the instructions in the readme.
... View more
10-06-2017
09:41 AM
|
0
|
0
|
1221
|
|
POST
|
My feeling is that you can download your preferred version of the API and host it yourself. I don't think the API should have any external dependencies if you do this. Of course a lot of defaults do point to ArcGIS Online, for example basemaps.
... View more
10-06-2017
05:54 AM
|
1
|
2
|
1221
|
|
POST
|
Off the top of my head, you might try using map.layers as opposed to map.allLayers. The main difference between those two is that map.allLayers includes the basemap layers. In general though, it's not obvious to me that your method would work. You aren't adding the group layer to the map, and the legend widget only shows up for layers that are in the current view. Also, I'm not sure if the legend widget can handle group layers at all. I think, unfortunately, you might just be stuck having a legend that with layers infos that look like this: function createLegend() {
var infos = map.layers.map(lyr => {
return {
layer: lyr,
title: lyr.title
};
}).toArray();
var legend = new Legend({
view: view,
layerInfos: infos
});
// Add widget to the bottom left corner of the view
view.ui.add(legend, "bottom-left");
}
... View more
10-05-2017
01:00 PM
|
1
|
0
|
987
|
|
POST
|
Do you know, more generally, if there is a way to set a symbol to be a simple dom element in any of Esri's JS symbol classes? I don't think so, I believe the closest thing you can get here is an SVG. I'm not sure the best way to stringify an SVG, using innerHTML seems a little hacky. Using google, I came across this which might be useful: var xml = new XMLSerializer().serializeToString(mySVGElement); You could probably create one XMLSerializer and perform all the "serializeToString" operations you need using it.
... View more
10-05-2017
09:55 AM
|
0
|
0
|
1256
|
|
POST
|
I'm not sure about iOS/safari, though it's my understanding that the API should be working on all major browsers, and if this isn't the case, that represents a problem. I would expect support for IE to be lagging a little behind (especially for 3D) but my understanding is that the goal is to support IE 11. I hope to get a chance to try to do some debugging on IE. I did notice that there's been some conversation about vector tiles not working well on IE on the JS API repo, so hopefully this issue will be dealt with eventually. My feeling is that you're probably best off sticking with whatever version works for the browsers your users typically use.
... View more
10-05-2017
09:17 AM
|
0
|
1
|
1633
|
|
POST
|
In your code, this segment won't work: //create elevation layer add to map
var elevLyr = new ElevationLayer({
// Custom elevation service
url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation /ESRI_Elevation_World/GPServer",
visible: false
});
// Add elevation layer to the map's ground.
map.ground.layers.add(elevLyr); The URL needs to point to an elevation service, which will look more or less like a tiled image service. You've already added the world elevation layer by setting ground to 'world-elevation' in the map constructor. As far as panning along the ground, by default you can use the left and right arrow keys to move the camera left and right and maintain the camera's current tilt and heading. To get a good look at terrain you'll have to zoom in and tilt the camera first. In order to tilt the camera, you could clone the current camera and change the tilt: var cam = view.camera.clone();
cam.tilt = 90; //degrees
view.camera = cam; or use goTo: view.goTo({ tilt: 90});
... View more
10-05-2017
07:43 AM
|
1
|
0
|
647
|
|
POST
|
As long as you're projecting from spatial reference A to spatial reference B for all 100 geometries, you only need to make one request to GeometryService.project. So in your case, you should get an array of geometries from every feature you want to project and use that array as prjParams.geometries. In general, when you want to do many requests at once, you should use Promise.all, like this: var features = [...] // array of graphics
var promiseArray = []; // empty array
for (let i = 0; i < features.length; i++){
var promise = doThingAsync(feature);
promiseArray.push(promise);
}
Promise.all(promiseArray).then(function(results){
// this code will be executed when every promise resolves
...
});
// function does something async, like an http request, and returns a promise
function doThingAsync(feature){
return new Promise(...);
}
But you probably don't have to do this here.
... View more
10-05-2017
06:16 AM
|
0
|
0
|
940
|
|
POST
|
Your app seems to work for me in Firefox. I'm using version 56. In IE 11.0.96 I'm seeing the problem, including the typedarray errors in the console that you posted. I don't think I've used IE with vector tiles before. Was it working in 4.4?
... View more
10-04-2017
01:38 PM
|
0
|
1
|
1633
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-03-2017 08:23 AM | |
| 1 | 11-02-2017 08:36 AM | |
| 1 | 11-02-2017 09:23 AM | |
| 1 | 09-20-2017 02:07 PM | |
| 1 | 10-06-2017 05:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|