|
POST
|
Different browsers have different dev tools setups and I'm not sure exactly what I'm looking at here. In general, you can print anything to the console using console.log(x, y, z) where x, y, and z are variables in your JavaScript code. This is generally the easiest way to see what's going on, in my opinion. If you console.log an object or an array, most dev tool consoles that I'm aware of give you this kind of interface so you can "inspect" the properties of the object by clicking on them to view the value of each property. My feeling is that the DOM inspector in your screenshot is probably the JavaScript global object (also known as window), which is the global scope where your code is run. Everything should be accessible in the global scope, but it's very large and will be a pain to look through since the entire JavaScript standard library is there. I'm not sure what you mean by "functions." If you mean functions/methods in the JS API, these are minified, which means the source code won't be easy to read. Some browsers (maybe all?) give you the option to unminify source code. In chrome, you can do this via the "sources" tab in chrome dev tools. In general though, you can't count on being able to read the JS API source code.
... View more
05-12-2017
01:45 PM
|
0
|
2
|
2126
|
|
POST
|
My guess would be that you can listen to the 'measure-end' event on the dijit, which will give you access to the result of the measurement and a geometry. From here, you could take that geometry and create your own graphic from it. You could use the measurement result (also from the measure-end event) as an attribute on that graphic. This graphic can then be added to a feature layer (probably a polyline feature layer) in order to persist it. You can add a label class to the feature service backing up that feature layer that looks at the attribute that represents the measurement result and applies it as a label.
... View more
05-12-2017
12:46 PM
|
1
|
4
|
1260
|
|
POST
|
It depends on what you mean by "measure in 3D." You can measure the distance between 2 points using the geometry engine: JS Bin - Collaborative JavaScript Debugging That example uses the geodesicLength method, so it includes the earth's curvature. There are also planar methods that don't. Measuring in 3D isn't really any different from measuring in 2D as long as you're measuring along the surface of the earth. Things get more complicated if you're interested in finding the distance between two points with z values. I agree that this is an area where the JS API lacks support.
... View more
05-12-2017
07:12 AM
|
0
|
4
|
2057
|
|
POST
|
Make sure you're setting the height on the container div.
... View more
05-11-2017
11:01 AM
|
0
|
0
|
442
|
|
POST
|
In the meantime, you can use the geometry engine for measurements. geometryEngine | API Reference | ArcGIS API for JavaScript 4.3 or geometryEngineAsync | API Reference | ArcGIS API for JavaScript 4.3
... View more
05-10-2017
06:10 AM
|
0
|
6
|
2057
|
|
POST
|
I'm not entirely sure of your requirements, but my guess is that there's no reason you can't do this currently if you're willing to dig into the API a little. If you have a list of graphics/features (with point geometries) and want to use an attribute on each feature as its z value, you could simply write a function to edit the geometries on each feature based on some attribute. Ideally you would set this up in your feature service beforehand (that is, make your feature service serve up features with z values set beforehand), but there's no reason you can't do it in the browser. Here's an example: JS Bin - Collaborative JavaScript Debugging In that example I used the index of each feature in the array as its z value, but you could access some attribute on the graphic for that purpose instead. This is also using a 2D symbol, but you could use a 3D symbol.
... View more
05-09-2017
02:21 PM
|
0
|
5
|
2122
|
|
POST
|
I don't see anything wrong with the code you posted. Removing a client-side feature layer seems to work fine in this sample: ArcGIS API for JavaScript Sandbox (I just added some code to remove the layer on click, seems to work fine). You could take a look at that sample closely and see if you're doing anything different.
... View more
05-08-2017
07:16 AM
|
0
|
0
|
1310
|
|
POST
|
Try setting the outSpatialReference property on the query. You might be able to set it to an object: { wkid: 102100 } or you might have to create a new SpatialReference with that wkid: SpatialReference | API Reference | ArcGIS API for JavaScript 4.3 ie new SpatialReference({wkid: 102100});
... View more
05-05-2017
02:03 PM
|
2
|
0
|
1678
|
|
POST
|
view.graphics can contain graphics with multiple geometry types, just like a graphicslayer. So the issue is elsewhere. I would check to make sure the spatial references on the polyline geometries are correct. That's a common issue and it's usually the first thing I check when something isn't showing up on the map. Aside from that, I'm not sure. The same you posted looks correct to me.
... View more
05-05-2017
01:38 PM
|
2
|
2
|
1678
|
|
POST
|
It looks to me like the issue is the polygon rings. Polygon rings should follow this format: rings:[ // array of rings
[ // first ring
[<vertex1X>, <vertex1Y>], //coords
[<vertex2X>, <vertex2Y>],
[<vertex3X>, <vertex3Y>],
[<...>, <...>], // for however many vertices you have
[<vertex1X>, <vertex1Y>]
]
] You could try changing your code to something like this: function createGraphics(response) {
// raw GeoJSON data
var geoJson = response.data;
// Create an array of Graphics from each GeoJSON feature
// changed feature in callback to feature to be more accurate
return arrayUtils.map(geoJson.features, function(feature, i) {
return {
geometry: new Polygon({
rings: feature.geometry.coordinates
}),
// select only the attributes you care about
attributes: {
ObjectId: i,
name: feature.attributes.Name
}
};
});
} I changed the callback so it takes an argument of "feature" and I'm just passing in the coordinates in the geoJSON because it looks to me like the geoJSON polygon ring format is the same as Esri's format.
... View more
05-05-2017
08:39 AM
|
1
|
1
|
1023
|
|
POST
|
I've never used synchronous http requests. It seems possible to me that this is an issue with synchronous http request support in some browsers. I'd try an async pattern to see if that changes anything. If you're pulling in the Esri JS API you could also use esriRequest which provides a nice wrapper around xmlHttpRequest and returns a promise.
... View more
05-03-2017
09:51 AM
|
0
|
0
|
2706
|
|
POST
|
In the 4.XX API a layer view can be queried for a graphics layer the same way you would query the layer view for a feature layer: // source: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
// returns all the graphics from the layer view
view.whenLayerView(lyr).then(function(lyrView){
lyrView.watch("updating", function(val){
if(!val){ // wait for the layer view to finish updating
lyrView.queryFeatures().then(function(results){
console.log(results); // prints all the client-side graphics to the console
});
}
});
}); You could pass a Query into layerView.queryFeatures with an extent geometry and the 'intersects' spatial relationship to query for features inside an extent. See Query | API Reference | ArcGIS API for JavaScript 4.3 for more details. If you're using the 3.XX API, my bet would be that you could easily write a query method yourself by accessing each graphic in a graphics layer and using the geometry engine to test each one. This is not an approach that scales especially well. I'm not sure if layerView.queryFeatures scales very well either.
... View more
05-03-2017
08:23 AM
|
1
|
6
|
3831
|
|
POST
|
You can use pro to create web scenes. I expect you'd need a license to use pro. You can also use the online web scene viewer: Scene Viewer
... View more
05-01-2017
07:29 AM
|
0
|
0
|
637
|
|
POST
|
I'm fairly sure you can't create a symbol like that. There's a distinction between the JSON representation of a symbol (or any class in the API) and the constructor parameters. Try something like this to create the symbol: var symbol = new SimpleMarkerSymbol({
"color": [255,255,255,64],
"size": 12,
"angle": -30,
"xoffset": 0,
"yoffset": 0,
"style": "circle",
"outline": {
"color": [0,0,0,255],
"width": 1,
"style": "solid"
}
}); You can also use esri/symbols/jsonUtils | API Reference | ArcGIS API for JavaScript 3.20 to convert from symbol JSON to an instance of a symbol. I suspect you're making a similar error when constructing a graphic. I would try using jsonUtils.fromJSON to parse the geometry JSON and pass that into the graphic constructor. It looks like Graphic does support JSON as a parameter, but I think it expects the symbol to be passed in as part of the JSON (optionally you could pass the symbol JSON as part of your web socket messages if you want, and then pass that whole JSON into the graphic constructor). But I would try something like this: var geometry = webMercatorUtils.geographicToWebMercator(jsonUtils.fromJson(message.data[0].geometry));
map.setExtent(map.extent.centerAt(geometry));
var graphic = new Graphic(geometry, symbol);
streamLayer.add(graphic); I also think you could get rid of the webMercatorUtils.geographicToWebMercator if you tag your geometry JSON with wkid: 4326.
... View more
05-01-2017
06:21 AM
|
0
|
1
|
1362
|
| 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
|