|
POST
|
It might be worth trying to add a native event listener for keydown to the view container: view.container.addEventListener("keydown", function(evt){...}); It's interesting that this may depend on OS version. My feeling is that this may have to do with whether the view is focused or not. Different OS/different browsers may have slightly different rules.
... View more
10-20-2017
08:58 AM
|
0
|
0
|
1029
|
|
POST
|
Here's a sample showing how you might allow points, polylines, and polygons to be dragged. In this example I'm using wherever the user clicked inside the polygon as the handle. You could easily use the centroid of the polygon as the origin/handle if you like: https://codepen.io/solowt/pen/QqoaeK?editors=1000#0
... View more
10-20-2017
07:52 AM
|
3
|
0
|
1782
|
|
POST
|
There's no built-in way to do this. In general, you need to clone a graphic, change the geometry on the clone, add clone to the layer, and then remove the old graphic. You can't just change the geometry. This will hopefully change in the future. In terms of how you'd implement this, I would approach this by determining the difference in X and Y between "the handle" ie the centroid in your case, but possibly any point inside the polygon, and the current location of the mouse. Then you'll want to translate every vertex in every ring of the polygon by that amount in X and Y. I'll see if I can put together a simple example of this.
... View more
10-20-2017
07:17 AM
|
0
|
1
|
1782
|
|
POST
|
My guess is that this has something to do with some combination of the widget rendering more than you'd expect (maybe more than necessary) and IE being outdated. When I look at performance on chrome, I see a small amount of additional resources being used when I add the search widget, but nothing excessive. I'm not particularly knowledgeable about browser performance or what the next logical steps would be to debug this. I'd recommend filing a bug report through customer service. If you have screenshots showing IE memory usage with and without the search widget, I'd include those.
... View more
10-19-2017
06:13 AM
|
0
|
0
|
1420
|
|
POST
|
Looks like this will be fixed in 4.6, sometime in early December.
... View more
10-18-2017
09:07 AM
|
0
|
2
|
2023
|
|
POST
|
I don't know much about this subject, but this looks possibly related: ArcGIS JSAPI setup build with Webpack for production (start reading from webpack.config.js) · GitHub
... View more
10-17-2017
08:31 AM
|
0
|
1
|
1002
|
|
POST
|
I'd question whether you'll actually gain anything noticeable from not requesting the service JSON until it's required. All of this data is requested asynchronously, so I'd be surprised if it slowed down your app or damaged user experience to load the service JSON before anything needs to be drawn. Also, if you defer loading the service JSON until the user decides to view the layer, you'll increase the delay between the user clicking "view layer" and them seeing features on the map compared to just toggling the layer's visibility. This is because feature layers need to make a couple requests end-to-end before anything is drawn, and the first of those requests, fetching the layer JSON, would already have been made if you just toggled visibility. If you're dead set on not making requests for data you may not need, one option would just be not adding the layer to the map. You can create a new Feature Layer, show it in a list, but only add it to the map the first time a user decides to view it. This will prevent any requests to the feature service until the layer is added, at least in 4.XX.
... View more
10-16-2017
11:00 AM
|
1
|
0
|
4206
|
|
POST
|
I imagine it would be a lot of work to do that. But if you just have a simple server that's serving up a bunch of features in XML, not necessarily an Esri service, then this should be straightforward. It also doesn't seem like it would too hard to query a SOAP based feature service and parse the features into something usable. Getting that service to work seamlessly with with the JS API would be a long slog though, and I think you're right that the best move would be republishing that service so that it supports REST if that's your goal.
... View more
10-13-2017
06:48 AM
|
0
|
0
|
1225
|
|
POST
|
You can use esri/Request to make a request to your web service. Then you can take the resulting XML and transform it into something JavaScript-friendly. I've never had to do this before but it shouldn't be too hard. This would look something like this: esriRequest(<url to your webservice>, {
responseType: "xml"
}).then(function(response){
// response.data is an XMLDocument
// let's say your features are described by <feature></feature> objects
// with longitude and latitude attributes
let nodes = response.data.getElementsByTagName("feature");
let featureArray = [];
for (let i = 0; i < nodes.length; i++){
featuresArray.push({
longitude: nodes[i].getAttribute("longitude"),
latitude: nodes[i].getAttribute("latitude)
});
}
return featureArray;
});
... View more
10-13-2017
06:08 AM
|
0
|
2
|
1225
|
|
POST
|
I don't think there's a set way to do this across browsers. The "standard" hack is to hide the file input, use your own button, and programmatically click the hidden input when the user clicks the button. This is pretty ugly but it works. Webkit browsers (chrome, safari) can use this CSS pseudoselector to select the button, like this: input[type="file"]::-webkit-file-upload-button{
// style button here
}
... View more
10-12-2017
08:30 AM
|
1
|
0
|
737
|
|
POST
|
The 3.X API has no concept of a MapView, which you reference in your code. This is a new concept with with 4.X. Your map service has a spatial reference with wkid 2600 so you can't deal with WGS84 geometries in the client. You should work with the projected coordinate system of the basemap. You can add your basemap like this: https://codepen.io/solowt/pen/YrjxoY?editors=1000
... View more
10-12-2017
05:52 AM
|
2
|
2
|
2729
|
|
POST
|
Thanks, I understand now. I don't think there's an easy way to get the API to do this. The way I'd approach this is something like: -Add scene layer to map. -Create companion feature layer but don't add it (is this done automatically?). -Whenever the view is stationary query the featureLayer and keep the resulting features in an array, overwriting the array whenever the extent changes. -Modify the renderer on the sceneLayer to use the features from the featurelayer instead of the features in the scenelayer, if they exist Something like this: const view;
// companion feature layer
const featureLayer;
// array to hold features
const featuresArray = [];
// sceneLayer
const sceneLayer;
// watch for when view stops moving
view.watch('stationary', isStationary => {
if (isStationary){
getFeatures(view.extent);
}
});
// update features in view
function getFeatures(extent){
const q = featureLayer.createQuery();
q.geometry = extent;
q.outFields = ['*'];
featureLayer.queryFeatures(q).then(featureSet => featuresArray = featureSet.features);
}
// override the getSymbol method on the renderer
sceneLayer.renderer.getSymbol = function(g){
// objectId of the feature being rendered
let oid = g.attributes[sceneLayer.objectIdField];
// search featureLayer for the same feature
let feature = featuresArray.find(f => f.attributes[sceneLayer.objectIdField] === oid);
if (feature){
// if we found a feature, use that feature to generate a symbol
return sceneLayer.renderer.__proto__.getSymbol.call(sceneLayer.renderer, feature);
} else {
// if we didn't, use the sceneLayer's version to generate a symbol
return sceneLayer.renderer.__proto__.getSymbol.call(sceneLayer.renderer, g);
}
} I don't have access to a scenelayer that has a companion feature layer so I can't test this, but in general I think it should work. It may not be an improvement over what you have currently though.
... View more
10-11-2017
06:47 AM
|
0
|
1
|
3527
|
|
POST
|
for now I have to watch the SceneLayerView's updating and request attributes from the connected FeatureService manually. I can't think of a better way to do this off the top of my head. When you said: I need to set the SceneLayer's renderer to reflect its attribute changes What do you mean by attribute changes?
... View more
10-11-2017
05:45 AM
|
0
|
3
|
3527
|
|
POST
|
My feeling is that the most straightforward way to do this would be to write your own pop-up component using whichever JS framework you're using and use that instead of the standard popup template. You may be able to use the popupViewModel to help out with this, though I haven't done that before. There may be a way to reliably render a third party component inside the popup reliably but my guess is that it would be a pain and you're probably going to run into issues with it playing well with the popup.
... View more
10-10-2017
12:01 PM
|
1
|
3
|
1639
|
|
POST
|
When you set outFields to ["*"] I don't think the query is going to be client-side anymore. This may be okay for your use case. You can check in dev tools, but I'd bet that you're firing off a bunch of requests when you do this. Scene Layers only fetch the object id field by default. They also fetch any field that is needed in the client for a renderer. There's no easy way to specify which fields should be fetched, although there are probably a number of options for forcing the layer to fetch the attributes you want. This means that, normally, SceneLayerView.queryFeatures() will only return the object id plus whichever fields the layer decided are required by the renderer. The client-side query can't return any fields that weren't fetched to draw the layer to begin with. When you pass in outFields, the layer seems to query the Scene Service rather than doing a client-side query. This is a little confusing: my assumption was that LayerView.queryFeatures() is always client-side. I don't know a lot about Scene Layer geometries, but I don't think they're like Esri geometries. Scene Services return some binary format that can represent vertices, meshes, pyramids, etc. I'm not sure how to get access to that data or what coordinate system it will be in.
... View more
10-10-2017
10:59 AM
|
1
|
5
|
3527
|
| 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
|