POST
|
Hi Pierre, It was a bad idea for me to have mentioned that approach (for exactly this reason, among others). A better approach would be creating your own function for querying graphics and feeding the results into the popup. You can see an example of how to do this here (scroll down a bit for two examples). In this case, you could write a function to query for all graphics in your layer using an extent centered on where you click: here's an example based on your sample. The downside of this approach is that you need to pick a number of pixels to search in, which isn't ideal, but it works (I set it to 10 in that example, but realistically it should be adjusted based on your symbol size). Alternatively, I checked your sample against the upcoming release of the API and it seems to work perfectly there.
... View more
09-06-201808:25 AM
|
1
|
0
|
437
|
POST
|
According to the feature layer docs, it's possible for the url property to point to the service root and for the layerId property to specify the index of the service, or for the url to include the index. So you could use the layerId property to distinguish between your two layers here. You could access these layers in a few ways. If you know that this app will always have a webmap with two layers, you could do: // webmap.layers is a esri/core/collection of layers excluding the basemap layers var layer1 = webmap.layers.getItemAt(0); var layer2 = webmap.layers.getItemAt(1); But if the webmap changes, your app could break. Alternatively, you could use the url and layerId to find the layers you want: var featureServerURL = "https://giswebnew.dotd.la.gov/arcgis/rest/services/DevTemp_Data/FreeValWorkzone_Pilot/FeatureServer" var layer1 = webmap.layers.find(function(layer) { return layer.url === featureServerURL && layer.layerId === 0; }); var layer2 = webmap.layers.find(function(layer) { return layer.url === featureServerURL && layer.layerId === 1; }); // but maybe it would be better to write a function and cover both cases function findLayer(url, layerId, map) { return map.layers.find(function(layer) { return (layer.url === url && layer.layerId === layerId) || (layer.url === url + "/" + layerId); }); } var layer1 = findLayer(featureServerURL, 0, webmap); var layer2 = findLayer(featureServerURL, 1, webmap); The docs also specify that, in the case where the url points to the service root and no layerId is given, the layer will pull in the first layer in the service. This may not be relevant for your case, but just something to keep in mind.
... View more
03-14-201806:43 AM
|
1
|
1
|
913
|
POST
|
Hi, Looks to me like the issue here is the version of the API you're using. 4.4 doesn't support autocasting renderers and symbols (that is, creating a renderer without using the constructor) - that functionality was added in 4.5. So, if you're using 4.4, you'll need to pull in UniqueValueRenderer and SimpeLineSymbol and use them as classes. I made a few changes and here's the result: JS Bin - Collaborative JavaScript Debugging One thing I changed was how you determine the layer to search. I just hardcoded your layer's URL. Another change I made is using a ClassBreaksRenderer instead of a UniqueValueRenderer. Since you're interested in highlighting all features in a range, that seems like the right choice. A final thing to note is that you may not actually have to do a query here since the min and max segment ids are available pre-query. You could just construct the renderer with that information. Here's another version that does the same thing without the query: JS Bin - Collaborative JavaScript Debugging
... View more
02-26-201802:01 PM
|
0
|
5
|
913
|
POST
|
Try setting the "resultSymbol" property on the Feature Layer Source. This sample has two Feature Layer Sources, I've set the first one so it will use a blue Simple Fill Symbol: JS Bin - Collaborative JavaScript Debugging (To trigger a search, just click the Search and select "Use current location").
... View more
01-30-201811:47 AM
|
1
|
1
|
722
|
POST
|
你好,斯科特,我不确定这将是准备在4。7. I should point out that Feature Layers in a Map View can be highlighted if webGL is used to render them. This capability is marked as beta, you can read more about it here (including how to enable it): FeatureLayer | API Reference | ArcGIS API for JavaScript 4.6 If this isn't an option, I think your best bet would be to watch the "selectedFeature" property on the popup: JS Bin - Collaborative JavaScript Debugging Using that approach, you'll have to decide how to highlight each geometry type. In that sample, a new polygon is added that outlines the feature returned from identify that is currently shown in the popup. For point geometries, you'd probably want to highlight things a little differently. Here's another SDK sample that shows how you might approach highlighting a point: ArcGIS API for JavaScript Sandbox (click on a feature to highlight). As far as the difference between selecting a feature and clicking on it, if you watch the "selectedFeature" property, you're just assuming whatever feature the popup is currently displaying is selected. You can manually add features to the popup (and therefore select them) as in the identify sample, using popup.open: Popup | API Reference | ArcGIS API for JavaScript 4.6. Or, depending on the layer and what kind of search you want to perform on click, you could take advantage of the built-in popup functionality, like this: JS Bin - Collaborative JavaScript Debugging.
... View more
01-30-201806:26 AM
|
1
|
3
|
722
|
POST
|
Okay, I think I understand your point. You're interested in a zoom event, but you'd like to intercept the event at a point before the zoom has actually occurred. You're commenting that the only way to do this is to watch for "double-click," "mouse-wheel," "+", and "-," and add a callback to each of these events separately, and this is inconvenient. That's a really good point, I can see how it would be helpful to allow a user to listen for a "zoom" event, inspect the event object, see what user input had triggered it, and decide on what to do from there. Unfortunately I don't think there's a built-in way to do this.
... View more
12-12-201701:17 PM
|
1
|
2
|
712
|
POST
|
You can watch any property that is an accessor property. Most classes in the 4.XX JS API inherit from accessor (Accessor | API Reference | ArcGIS API for JavaScript 4.5 ), which allows properties to be watched. Drag is different as it is a mouse event that can registered on a view. https://codepen.io/solowt/pen/opNaXo?editors=1000 esri/core/watchUtils is useful for more complex stuff than just watching for a property change. Really? An event as significant as zoom, drag are all inferred by watching the stationary flag? I'm not sure what you mean by this. If I wanted to watch zoom for changes I would use view.watch("zoom", callback);
... View more
12-12-201711:41 AM
|
0
|
5
|
712
|
POST
|
The Feature Layer won't attempt to load unless you add it to the map or manually load it. So try returning new FeatureLayer({ ... }).load(), or add the Feature Layer to your map before returning it. I should note, I'm not sure if a sublayer in a MapImageLayer can be a FeatureLayer.
... View more
12-12-201710:58 AM
|
1
|
1
|
2042
|
POST
|
Nice job figuring this out from the minified code! 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. My feeling is that your change isn't going to break anything for now, and as long as you test it with each update, you'll probably be fine. Fair warning though, I'm not particularly knowledgeable about this part of the API, and it's not clear to me why the JS API doesn't just use the browser's request queue. Yann Cabon might have some better advice
... View more
12-12-2017晚10点
|
1
|
0
|
573
|
POST
|
我的感觉是,素描工具主要是目的at 2D. Drawing in 3D is a more complicated task. You can set things up to "draw" on 3D objects: https://codepen.io/solowt/pen/MrWOvV?editors=1000 (hold control + drag to draw). The key here is that each drag event has an x, y in pixels that is transformed into a point with x, y, and z in world coordinates, so we're just adding a new x, y, z vertex to the polyline for every drag event. The x, y, z coordinates will respect terrain and 3D Objects, allowing us to draw with respect to whatever the x, y in pixels is intersecting, whether it's terrain or a 3D Object. To change how graphics are placed in a Scene View, you can adjust a layer's elevationInfo. You can check out the API documentation for the elevationInfo property on various layers to see how this works. { mode: "relative-to-scene" } may give you something closer to what you're looking for. I would say that for drawing in 3D, if you have to deal with 3D Objects, your best bet for now is to write your own draw tools, similar to the sample I posted, and tailor it to your use case. Keep in mind that "drawing in 3D" is hard to define and you're going to run into lots of weirdness, especially when it comes to drawing Polygons, but also with Polylines. I drew from this perspective, and it looks like what I want: But after rotating the camera, I see I've really drawn this geometry:
... View more
12-12-201708:53 AM
|
2
|
1
|
768
|
Title | Kudos | Posted |
---|---|---|
1 | 05-03-201708:23 AM | |
1 | 11-02-201709:23 AM | |
1 | 11-02-201708:36 AM | |
1 | 10-06-201705:54 AM | |
3 | 12-06-201708:46 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-202002:24 AM
|