POST
|
Right, I must be doing something wrong. I tried that method: export const test = () => {
return esriPromise(['esri/layers/MapImageLayer']).then(([ MapImageLayer ]) => {
var layer = new MapImageLayer({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
sublayers: [ {id: 2,visible: false},{id: 1,visible: false},{id: 0,visible: false}]});
map.layers.add(layer);
var sublayer= layer.findSublayerById(0);
console.log("sublayer: ", sublayer);
// when the createFeatureLayer() promise resolves, load the FeatureLayer
// and pass it to the createFeatureLayer function
sublayer.createFeatureLayer()
.then((featureLayer) => {
console.log("blah")
return featureLayer.load();
})
.then(createFeatureLayer);
function createFeatureLayer (featureLayer) {
featureLayer.visible = true;
map.add(featureLayer);
console.log("featureLayer: ", featureLayer);
}})
} And I am still getting the same error: Now you can see I am using @esri/react-arcgis, could this be the issue (never had a problem before). Or am I doing something obviously wrong, that I can't see.
... View more
04-11-2019
06:52 AM
|
0
|
1
|
945
|
POST
|
Yes I checked. I am able to turn the visibility on/off etc.
... View more
04-10-2019
09:24 AM
|
0
|
5
|
945
|
POST
|
Hello, I am trying to create a feature layer from a MapImageLayer sublayer and it's not working. Using the code snippet from the API (4.11) doc: var sublayer = mapImageLayer.findSublayerById(0); // here it is finding the sublayer sublayer.createFeatureLayer().then(function(featureLayer){ return featureLayer.load(); }) The error I am getting is : Uncaught (in promise) TypeError: sublayer.createFeatureLayer(...).then is not a function Any idea ?
... View more
04-10-2019
09:14 AM
|
0
|
7
|
1232
|
POST
|
Hello, I am trying to query all the points in my feature Layer that don't intersect a polygon geometry. I am wondering what is the best way to do that. (I'd like an api solution if possible, otherwise I guess I could query all the ones that do intersect, and substract them from the entire dataset) I tried using "relate" as spatial relationship and "FF*FF****" as a parameter. It fails, and bring me a "timeout" error. (I tried and some other parameters do work). My layer has around 50k features, and the polygon intersects around 800 features. var query = featureLayer.createQuery(); query.returnGeometry = true; query.outFields = ["*"]; query.geometry = polygon; query.spatialRelationship = rel if(rel == "relation"){ query.relationParameter = "FF*FF****" } return featureLayer.queryFeatures(query).then((data) => {
... View more
02-11-2019
03:56 AM
|
0
|
0
|
301
|
POST
|
Still not working for me. I have a Feature Layer with a UniqueValueRenderer, tried featurelayer.refresh() or the refresh interval, tried the request interceptor above, not working. I still have to manually zoom in and out for the layer to refresh.
... View more
01-29-2019
08:32 AM
|
2
|
1
|
1550
|
POST
|
Nevermind, I forgot to add the "units" parameter. Works ok now.
... View more
01-14-2019
05:08 AM
|
0
|
0
|
398
|
POST
|
Hi, I am trying to make a query to a map service using "distance" as a parameter. However that does not work. In the service itself and under Advanced Query Capabilities , I don't see that my service supports it. I have ArcGIS Server 10.3.1 so it should be available right? Where can I add this capability (if I can) ? Thanks,
... View more
01-14-2019
04:26 AM
|
0
|
1
|
554
|
POST
|
Yes I tried that, and yes you can't see the changes until you zoom in/out, which is not great for what I was trying to achieve. Anyway good to know that , this will be the case in 4.10.
... View more
10-18-2018
08:24 AM
|
0
|
0
|
791
|
POST
|
I haven't tested on 4.8 yet. I found a workaround though, if I set a time constraint on the setAngle function, this works fine. Apparently when things are going too fast, the graphicsLayer fails to clear the graphics, and they stay in memory somewhere. This is working: panorama.addListener('pov_changed', function(e) { if(currentPointer != null){ const newHeading = panorama.getPov().heading; var d = new Date().getTime(); if(storedDate == null || d - storedDate > 200 ){ storedDate = d; setAngle(currentPointer, newHeading) } } });
... View more
10-18-2018
07:08 AM
|
1
|
0
|
791
|
POST
|
Hi, RemoveAll() is "not working", as in it's removing the graphics from the layer as expected. When I view the graphicsLayer it only has 1 item, the correct one. However intermediate graphics are still showing on the map, and I can't see on which layer they are.. I am not using view.graphics (although I tried that too, instead of the graphics layer, and had the same problem) Strange thing is when I do the change position bit, it's working ok. It really looks like the issue is the "speed rate" at which the setAngle is called: function move(graphic, geometry){ var point = new Point({x:geometry.lng, y:geometry.lat}) graphicsLayerMap.removeAll(); currentPointer = graphic.clone(); currentPointer.geometry = point; graphicsLayerMap.add(currentPointer); } panorama.addListener('position_changed', function() { if(currentPointer != null){ const newPosition = panorama.getPosition(); var unit = {lat: newPosition.lat(), lng: newPosition.lng()}; move(currentPointer, unit) } });
... View more
10-18-2018
06:15 AM
|
0
|
1
|
791
|
POST
|
Hello, I am trying to add a graphic on the map and update its angle/position based on a property received from an API (google streetview). I am creating a GraphicsLayer that I add to the map, I then add a Graphic with the initial position/angle returned by the API. That's working fine. I then wanted to update the graphic's position for when the user moves in the streetview window. As it's not possible yet to update a graphic (api 4.9) , I remove the graphic from the layer, change its geometry and add it back. Working fine too. Now I want to modify the angle of the graphic, I am using the same process, it's successfully changing the angle of the newly added graphic, and removing the old one from the layer, but they all seem to stay "floating "on the map somehow. Below is the code: (I also tried to create a brand new Graphic instead of cloning, same behaviour) function setAngle(graphic, newHeading){ graphicsLayerMap.remove(graphic); // tried removeAll() currentPointer = graphic.clone(); currentPointer.symbol.angle = newHeading graphicsLayerMap.add(currentPointer); } panorama.addListener('pov_changed', function() { if(currentPointer != null){ const newHeading = panorama.getPov().heading; setAngle(currentPointer, newHeading) } }); And the result (in blue the rogue graphics, and in red the correct one within the layer): If anyone can help me make sense of that.
... View more
10-18-2018
03:04 AM
|
0
|
8
|
950
|
POST
|
Hello, I changed my app's default API from 4.8 to 4.9 and am getting a CORS error when loading our layers in development mode (localhost). Our webserver is CORS enabled, and it used to work fine in 4.8. I am aware of the changes made in 4.9 regarding cors: I am getting a 401 unauthorized error, and when adding the domain to esriConfig.request.trustedServers (we are using web authentication), I am getting the following error : The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:8080, *', but only one is allowed. Origin 'http://localhost:8080' is therefore not allowed access. Now I disabled web security in a Chrome window, and that works fine there. It's a good enough work around, but I was wondering if there was a way to make it work in "normal" mode. Thanks,
... View more
10-09-2018
05:30 AM
|
0
|
1
|
806
|
POST
|
I tested it, and it works for me using 4.9 but not 4.8. So I'll upgrade the API version in my app at some point. Thanks.
... View more
10-04-2018
08:03 AM
|
0
|
1
|
974
|
POST
|
Hello, I am using 4.8 and I can't seem to make the Labeling work for Feature Layers in 2D MapViews. In the documentation it is written that Feature Layer 'supports label placement for Point and Polygon geometries in 2D MapViews', and there is no other mention of a limitation. However in the 4.8 Realease Notes, it's stated that Labeling is only supported for WebGL enabled feature layers (We are using an older version of arc server, so that is not an option). Is there a way to make it work, or is it a development that is planned in the future? Thanks,
... View more
10-04-2018
04:45 AM
|
0
|
4
|
1155
|
POST
|
Ok, found the answer myself (just starting with Arcade Expressions): Only need that: var renderer = { type: "unique-value", valueExpression: "IIF( IndexOf( ["+ids+"], $feature.UID) > -1 ,'true','false')"
... View more
09-28-2018
05:10 AM
|
0
|
0
|
139
|
Title | Kudos | Posted |
---|---|---|
1 | 11-02-2022 08:39 AM | |
1 | 06-21-2022 02:29 AM | |
1 | 01-12-2022 03:09 AM | |
1 | 07-07-2021 05:35 AM | |
1 | 10-18-2018 07:08 AM |
Online Status |
Offline
|
Date Last Visited |
02-07-2024
05:26 PM
|