|
POST
|
I also had to enable support for dynamic layer on the map service in ArcGIS Server as well as set the image format to PNG32 for the dynamic layer.
... View more
07-19-2016
07:26 AM
|
0
|
0
|
1513
|
|
POST
|
Big thanks to John Gravois over on GIS Stack Exchange for tackling this one. I had tried to adjust the LODs but didn't think to start at -1. Here's the relevant code: tileInfo: new TileInfo({ spatialReference: new SpatialReference({ "wkid": 3857 }), rows: 512, cols: 512, origin: { "x": -20037508.34, "y": 20037508.34 }, lods: [ {"level":-1,"resolution":156543.033928,"scale":591657527.591555}, // typically 0 {"level":0,"resolution":78271.5169639999,"scale":295828763.795777}, // typically 1 {"level":1,"resolution":39135.7584820001,"scale":147914381.897889}, {"level":2,"resolution":19567.8792409999,"scale":73957190.948944}, {"level":3,"resolution":9783.93962049996,"scale":36978595.474472}, {"level":4,"resolution":4891.96981024998,"scale":18489297.737236}, {"level":5,"resolution":2445.98490512499,"scale":9244648.868618}, {"level":6,"resolution":1222.99245256249,"scale":4622324.434309}, {"level":7,"resolution":611.49622628138,"scale":2311162.217155}, {"level":8,"resolution":305.748113140558,"scale":1155581.108577}, {"level":9,"resolution":152.874056570411,"scale":577790.554289}, {"level":10,"resolution":76.4370282850732,"scale":288895.277144}, {"level":11,"resolution":38.2185141425366,"scale":144447.638572}, {"level":12,"resolution":19.1092570712683,"scale":72223.819286}, {"level":13,"resolution":9.55462853563415,"scale":36111.909643}, {"level":14,"resolution":4.77731426794937,"scale":18055.954822}, {"level":15,"resolution":2.38865713397468,"scale":9027.977411}, {"level":16,"resolution":1.19432856685505,"scale":4513.988705}, {"level":17,"resolution":0.597164283559817,"scale":2256.994353}, {"level":18,"resolution":0.298582141647617,"scale":1128.497176}, {"level":19,"resolution":0.14929107082380833,"scale":564.248588} ] }) Live demo here: https://dl.dropboxusercontent.com/u/59331579/js/tiled3x.html
... View more
05-16-2016
04:24 AM
|
0
|
0
|
1081
|
|
POST
|
I'm trying to use a MapBox basemap in a JS API (3.16) app and they are using tiles that are 512px instead of the typical 256px. This causes the map to be one zoom level off and the labels and such appear 'shrunk': Mapbox Satellite Streets | Mapbox versus Edit fiddle - JSFiddle I think I might be able to set the tileInfo on the webTiledLayer to adjust for this, but after some playing around, I have not found success. Leaflet has a zoomOffset property in their tiledLayer that allows for this change, but no such thing exists in the JS API. I've also tried to modify the LODs by altering the level by 1, but that didn't work either. What is the correct tileInfo for MapBox basemaps or how do I get the zoom levels adjusted so that the map renders correctly? Thanks!!
... View more
05-12-2016
06:56 AM
|
0
|
1
|
2409
|
|
POST
|
I'm adding print functionality to an existing application. Everything works fine and the output .pdf looks fine in the browser, but when its actually printed, the map and any added graphics are mirror images (upside down and flipped). Oddly, this only occurs in Mozilla Firefox (46.0.1). I've tried two different printers with the same result. The printout looks fine in Edge, IE and Chrome. Has anyone else run into this issue? It happens in my test app and also with this sample: https://developers.arcgis.com/javascript/3/samples/widget_print_esri_request/ Perhaps this is a Firefox issue? Thanks for any help.
... View more
05-10-2016
12:09 PM
|
0
|
0
|
1162
|
|
POST
|
Ok folks, I've figured out a way to do this. It requires the geometryEngine module that wasn't available when this thread was started. It has some hiccups for what I want to do with it (offset lines that partially overlap and are not completely coincident within the same featureLayer) but as long as overlapping lines or portions of lines are coincident, it will work. You may have to tweak the code for your situation. ArcGIS JavaScript Offset Lines - JSFiddle Also, you may need to play around with the offset distance mulitplier in the calcOffset function depending on line widths (I used 3 here): function calcOffset() { return (map.extent.getWidth() / map.width) * 3; } Cheers
... View more
04-13-2016
10:25 AM
|
1
|
1
|
2906
|
|
POST
|
Has anyone found a solution to this problem? Editing the geometry to be offset before publishing the feature service will not work for me because the amount of offset needed will vary depending on zoom level. Maybe there is a way to offset the SVG (dx, dy?) graphic after determining if two or more features overlap? I'm not yet savvy enough with SVG to code this myself (and I'm not sure how this approach would impact performance since these calculations would have to be done every time a user zooms in or out). For now, I'm thinking about adding labels so that when two features overlap and appear as 'one', the user will at least see two labels indicating two features.
... View more
04-13-2016
06:25 AM
|
0
|
0
|
2906
|
|
POST
|
I've been testing with Mozilla Firefox. Its possible that this code does work and I'm just being crazy. Anyway, thanks for taking a look! Hopefully others can use this as a sample to get the same effect in another app.
... View more
03-28-2016
08:59 AM
|
0
|
1
|
1264
|
|
POST
|
I'm trying to add a 'pulsing' effect to a graphics layer but the 'pulse' is not consistently timed. There must be some issue with my setTimeout and setInterval functions, but I can't quite pin it down. Any help is much appreciated! pulsing graphics layer - JSFiddle
... View more
03-28-2016
08:19 AM
|
0
|
4
|
2574
|
|
POST
|
Well it was an issue with the ip address and my testing environment - I'm up and running via appending the '?token=****' method.
... View more
01-27-2016
08:43 AM
|
0
|
0
|
1058
|
|
POST
|
Is there a way to do app authentication without a proxy? Say, manually generate a long lived token, hard code that into the app, and use the token to access secure services. In this case I don't care if someone can see the token or other needed login information from developer tools because the app is internal. I tried appending '?token=********' to the map service url, but that failed (possibly a ip address issue in my testing environment?). Or can I programmatically login via the identity manager without displaying a dialog box? Thanks for any help you can provide! (FYI, the services are hosted on ArcGIS for Server, not AGOL)
... View more
01-27-2016
08:31 AM
|
1
|
1
|
1058
|
|
POST
|
I haven't explored using the editor widget but here is a code sample that will merge polyline graphics into one geometry: function mergeLines(graphicsArray){
// merge geometries of graphics into one geometry
var polyline = new Polyline(map.spatialReference);
for (var i = 0; i < graphics.length; i++){
var paths = graphics.geometry.paths;
for (var j = 0; j < paths.length; j++){ //needed for multi part lines
polyline.addPath(paths );
}
}
return polyline;
}
var mergedGraphicGeometry = mergeLines(); the graphicsArray could be map.graphics.graphics, featureLayer.graphics, featureLayer.getSelectedFeatures(), a manually populate array, etc. Hope that helps!
... View more
12-02-2015
09:13 AM
|
0
|
0
|
1144
|
|
POST
|
I haven't explored using the editor widget but here is a code sample that should get you started: function mergeLines(graphicsArray) {
// merge geometries of polyline graphics into one geometry (graphics array could be map.graphics.graphics, featureLayer.graphics, etc.)
var polyline = new Polyline(map.spatialReference);
for (var i = 0; i < graphics.length; i++){
var paths = graphics.geometry.paths;
for (var j = 0; j < paths.length; j++){ //needed for multi part lines
polyline.addPath(paths );
}
}
return polyline;
}
var mergedGraphicGeometry = mergeLines();
... View more
12-02-2015
09:07 AM
|
0
|
0
|
1354
|
|
POST
|
The developer console is a feature that’s pretty standard in most browsers these days. In Google Chrome press CrtlShiftI or in Mozilla Firefox press CrtlShiftk Then find the web console and you’ll be able to investigate the layers object. Console.log or alert() are really effective debugging tools.
... View more
11-19-2015
01:14 PM
|
0
|
1
|
3701
|
|
POST
|
Cynthia, You’ll need to replace graphicLayer with a graphic layer or feature layer. Right now graphicLayer is not defined. Typically I’d do something like: var featureLayer = new FeatureLayer(url, ); map.addLayer(featureLayer); map.on(‘load’, function(){ featureLayer.enableMouseEvents(); featureLayer.on(‘mouse-over’, function(){ map.setMapCursor(‘pointer’); }); }); I’m not sure how best to get that featureLayer object from an AGOL webmap – maybe try: var layers = map. getLayersVisibleAtScale(); console.log(layers); then check out the layers object in the developer console and find the layer ID. The assign var featureLayer = map.getLayer(id); Good Luck, Brandon
... View more
11-19-2015
12:37 PM
|
0
|
4
|
3701
|