|
POST
|
Jeff, You and I have discussed this before. Esri widgets don't like token appended urls. When the api makes requests it checks the layer._getToken() to see if the service is secured. At 3.0 the api stopped checking to see if the layer url was in fact token appended (in favor of Identity Manager and the detriment of the developer). The work around is to reset layer.url w/o the token after creating but before adding the layer to the map. I use an json to load layers and in so use "secured" and "token" params to append the url when creating the layer and then reset it. // layer json (layerInfo below) { type: 'dynamic', id: 'vertcontrol', url: 'https://some_server/arcgis/rest/services/Control/Vertical_Control/MapServer', name: 'Vertical Control', secured: true, token: 'some_token' } // in layer loading class // create layer var li = lang.mixin({ secured: false, token: null, visible: false, opacity: 1, imageFormat: 'png32', dpi: 96, sublayers: true, identify: true, query: true }, layerInfo); this.layerInfo = li; var ip = new ImageParams(); ip.format = li.imageFormat; ip.dpi = li.dpi; this.layer = new Dynamic((li.secured) ? li.url + '?token=' + li.token : li.url, { id: li.id, imageParameters: ip, visible: li.visible, opacity: li.opacity }); this.layer.mapx = li; // reset url if (li.secured) { this.layer.url = li.url; } You can also use layer._getToken() for your own requests thereafter: _getLegend: function (deferred, layer) { var url = layer.url; if (!isNaN(parseInt(url.charAt(url.length - 1), 10))) { url = url.replace('FeatureServer', 'MapServer'); url = url.substring(0, url.length - 2); } esriRequest({ url: url + '/legend', callbackParamName: 'callback', content: { f: 'json', token: (typeof layer._getToken === 'function') ? layer._getToken() : null } }, { usePost: this.usePost }).then(function (r) { deferred.resolve(r); }, function (e) { console.log(e); deferred.reject('getLegend::an error occurred retrieving legend'); }); },
... View more
03-24-2014
10:56 AM
|
0
|
0
|
751
|
|
POST
|
Here's the help: http://resources.arcgis.com/en/help/main/10.2/index.html#/Printing_maps_that_contain_secured_services/0154000005q3000000/
... View more
03-24-2014
08:08 AM
|
0
|
1
|
1087
|
|
POST
|
Jay, You need to add your credentials to the print tool before publishing the print task. There's a help page for it but I can't seem to find it. Here's how: 1) copy Export Web Map tool to a new toolbox 2) right click and now Edit is enabled and select it 3) fill in credentials 4) publish as usual You do need catalog to be connected to the server(s), which I assume you do.
... View more
03-24-2014
08:01 AM
|
0
|
0
|
1087
|
|
POST
|
Solved. web tiled doesn't do an async call for metadata like AGS tiled and dynamic so load happens when you do new WebTiledLayer() In my case my layer loading class assumed 'load' fired on layer added to map. Because web tiled layer fires load immediately on creation, web tiled layer was never getting passed on to the layer control and event creating methods. Web tiled layer can be passed on immediately without issue. Thanks Derek!
... View more
03-21-2014
08:30 AM
|
0
|
0
|
569
|
|
POST
|
Starting from scratch isn't that bad. The thing with the esri widget, it has to take into effect every possible use and and isn't very customizable. With your own widget you have control over the look, feel and functionality. My widget is only a couple hundred lines long + a simple template. In the time spent trying to make the esri widget do what you want you could have your own. It's super easy if you use web mercator or lat/lng as you can use esri/geometry/geodesicUtils to compute accurate results in any unit w/o using a geom service.
... View more
03-19-2014
12:45 PM
|
0
|
0
|
1414
|
|
POST
|
How is this? Inherits from esri/layers/TiledMapServiceLayer... The layer object has Load and onLoad functions... Can see layer object 'loaded = false' --> 'loaded = true' when adding layer from command line... The layer object is an emitter... A fiddle. Yes I call ons and connects I know don't work just to check.
... View more
03-10-2014
06:09 PM
|
0
|
1
|
924
|
|
POST
|
Bootstrap integration with ArcGIS, you might want to check out this OS project I published a while back. It should jumpstart folks considerably. Sorry for not plugging bootstrap-map-js. It's the place to start for ESRI JS + Bootstrap. Thanks and keep up the good work!
... View more
03-04-2014
08:25 AM
|
0
|
0
|
976
|
|
POST
|
Try: dojo.connect(pointsOfInterest, "onEditsComplete", function (a, u, d) { var objectId = a[0].objectId; pointsOfInterest.setDefinitionExpression("OBJECTID = " + objectId); pointsOfInterest.refresh(); //for good measure }); Also, consider switching to AMD sooner than later.
... View more
03-04-2014
07:50 AM
|
0
|
0
|
887
|
|
POST
|
Henry, The 'edits-complete' event returns the object id of the new feature. Use this value to set the definition expression of the layer. featureLayer.setDefinitionExpression("OBJECTID = " + THE_RETURNED_OBJECTID); I've not tried this on layer while editing, but I think it should work fine.
... View more
03-01-2014
01:05 PM
|
0
|
0
|
887
|
|
POST
|
Matthew, I'm not w/ esri. It doesn't seem like the jsapi team answers these kinds of questions. The dev summit is right around the corner and I suspect they're quite busy preparing for it. Check out http://terraformer.io/ for using geojson with the jsapi. From my favorite esri folks @esriPDX. I've had real success with the jsapi for about 5+ years now. I don't know your experience with dojo but to effectively use the jsapi you need a certain level of knowledge of dojo. Even if you're just using the map and layers with some other framework. Learning to write custom modules in dojo is a must for any app with custom functionality. It can be used with Bootstrap. I'd tell you more, but I'm for the first time venturing from pure dojo/jsapi for internal viewer style apps to simpler pretty map apps. I just started with Bootstrap with the jsapi a couple weeks ago, and so far no problems. It's my first experience with jquery as well, and I'm finding it simpler for manipulating the dom in some situations. Requiring and using jquery plugins within my custom dojo modules has worked so far. The graphics and graphic layers work great. Multi-part geometry no problem. Complex geometries, and lots of graphics on multiple layers are no problem. It's fast without any display issues to speak of. Icons are icons, but I think polylines and polygons look best in the jsapi (others will disagree). Back to icons (picture marker symbols in the jsapi), they don't natively have a 2nd image parameter for a shadow image. The icon image must include it or you need a custom class to extend the graphic to have two symbols or have two points (messy). One of a couple features every other api seems to have but the jsapi does not. Styling the graphics is easy and changing symbols is a snap. The jsapi has methods to easily create/use symbol json. Depending on how your geojson is being created, you could very easily include the esri symbol json with it. The graphics layers (graphic and feature) have a lot of functionality themselves. The great thing about the jsapi is it's designed to work with robust GIS data. While the jsapi is really geared toward working with data from ArcGIS Server, functionalities like unique rendering can be easily used for any data source. Working with attributes (geojson properties) for data purposes is easy. If you need grids, dgrid is awesome. Dojo has great charting and graphing abilities. And now with http://d3js.org/ the sky is the limit for data visualization. I'm preparing to start a project with a map and interactive temporal graph displaying 725,006 temperature readings over the last 20 years and I'm planning on using the jsapi and d3. In my opinion, the biggest problem is ordering layers. Because it's vectors, graphics can cover/hide each other and make them inaccessible to interaction, especially with polygons. This is an issue with any web map with vectors I suppose. The api provides methods for moving graphics up/down in the layer and for reordering the layers themselves. I tend to only use graphic/feature layers for displaying temporary graphics for my measure widget as an example, or when I'm editing, which really isn't an issue for you. I do have a map annotation module for drawing, editing, and stylizing graphics which requires a lot of graphic and layer ordering control. I think the jsapi is great, and in my personal opinion there's no better web mapping api for high functioning apps. Of course the meteoric rise of Leaflet gives developers another viable option. I'm confident saying there's nothing the jsapi and dojo can't do, but that doesn't mean it's the best api for your app. If you were interested in me looking at a demo and giving an honest opinion on whether I think the jsapi would be a good fit, I'd be more than happy. Otherwise good luck! Ben
... View more
03-01-2014
11:22 AM
|
0
|
0
|
976
|
|
POST
|
Yes. The example uses the field alias from the data's attribute table. Details like setting field aliases, field descriptions, service description, etc make developing much easier. Heck I use document info, service tags, layer description, etc to store additional info (stringified json) for parameters used by my custom classes for creating TOC, query/identify params, editing params, etc so I don't have to do it in the app. Something I've been doing lately is using a published service with tables to store and retrieve json for layer and task specific parameters. I'm hoping to get started on a table with all of my most used esri graphics symbol json soon. AGS rocks! I have control over most of data and services I work with. If you don't, there's not much you can do. I've made suggestions to couple fed agencies with AGS I use to improve the usefulness of their services with field aliases and layer descriptions, but so far no luck.
... View more
02-27-2014
07:04 AM
|
0
|
0
|
1822
|
|
POST
|
One way is to make a request to the layer's endpoint and retrieve the layer's info, then iterate through the fields to add fieldInfo object for each field. I add result to the corresponding layerInfo as the info object. That way if I want it again I don't need to make a request. This is especially handy for an app with several classes and widgets that may need layer info. function createPopupContent(layer, layerId) {
esriRequest({
url: layer.url + '/' + layerId,
content: {
f: 'json'
token: layer._getToken()
},
handleAs: 'json',
callbackParamName: 'callback'
}).then(function (r) {
layer.layerInfos[layerId].info = r; //add result to layer's LayerInfo
var popupContent = {
title: 'Business ID#: {UNIQUEID_1}',
fieldInfos: []
};
array.forEach(r.fields, function (field) {
if (field.type !== 'esriFieldTypeOID' && field.type !== 'esriFieldTypeGeometry' && field.type !== 'esriFieldTypeBlob' && field.type !== 'esriFieldTypeRaster' && field.type !== 'esriFieldTypeGUID' && field.type !== 'esriFieldTypeGlobalID' && field.type !== 'esriFieldTypeXML') {
popupContent.fieldInfos.push({
fieldName: field.name,
visible: true,
label: field.alias + ': '
});
}
});
return popupContent;
}, function (e) {
console.log(e);
});
}
... View more
02-26-2014
03:03 PM
|
0
|
0
|
1822
|
|
POST
|
I'd use Ken's example, but my layer is a FeatureLayer while his example shows a ArcGISDynamicMapServiceLayer. Is there a way to convert one to the other? I am using AGOL rather than ArcGIS Server. I'm guessing that ArcGISDynamicMapServiceLayer's are produced by Server. Your service doesn't have a corresponding MapServer endpoint like AGS. I'm not sure how AGO works, but someone here can help you out. Good Luck!
... View more
02-26-2014
12:04 PM
|
0
|
0
|
2267
|
|
POST
|
Daniel, It is possible to move an overlay layer above graphics layers, however it is accomplished outside of the jsapi, and requires some advanced knowledge of the dom and dojo to accomplish it. Unfortunately doing so will cause several problems. Here's an image of the map's dom node from your fiddle. As you can see graphic/feature layers exist in a dom node at the same level as overlay (dynamic, tiled, web tiled, wms, etc) layers. When you reorder layers, if it's an overlay layer it's reordered with the other overlay layers. If it's a graphic/feature layer it's reordered within the graphics dom node. [ATTACH=CONFIG]31789[/ATTACH] You can use dojo (or pure js) to move an overlay above (it's reversed in the dom - top most dom node is the lowest layer) the dom node containing all the graphic/feature layers. HOWEVER, doing so will "cover up" the graphics layers and you WILL NOT be able to interact with them, such as clicking, which in necessary to show the popup for example. And if you try to reorder any layer with the api's reorderLayer() after having done so, the map will crash. Hopefully, that explains what's going on and why you shouldn't do it. As one solution to your problem, take Ken's example and simply add a click event to the map to identify, highlight (with map.graphics) and show popup using your layer.
... View more
02-26-2014
10:11 AM
|
0
|
0
|
2267
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2013 06:56 AM | |
| 1 | 06-30-2015 09:17 AM | |
| 1 | 10-12-2013 07:14 AM | |
| 1 | 02-05-2014 11:05 AM | |
| 1 | 05-28-2015 11:41 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|