|
POST
|
I'd suggest you to get JSONs of the generated webmap and the save-as copy of the same webmap using agol assistant and compare the content of the JSON to see the difference, then you can adjust your code accordingly.
... View more
06-12-2019
06:21 PM
|
0
|
0
|
1908
|
|
POST
|
Thank you Egge-Jan, Maybe I didn't state my issue clearly. I built the webmap in ArcGIS Online, and I "load" it using ArcgIS JavaScript API 3.28 like the following: arcgisUtils.createMap("4abe6a830b8f466dacf8abfde567a781", "map").then(function (response) {
//update the app
dom.byId("title").innerHTML = response.itemInfo.item.title;
dom.byId("subtitle").innerHTML = response.itemInfo.item.snippet;
var map = response.map;
//add the scalebar
var scalebar = new Scalebar({
map: map,
scalebarUnit: "english"
});
The above is a code snippet from this ESRI exmaple. In this case, I found I can't change the basemap of the webmap.
... View more
06-12-2019
05:32 PM
|
0
|
2
|
3418
|
|
POST
|
Can you view the generated web map properly in the Map Viewer in AGOL? and check the permission of this map, when you save a web map, you are the owner of the copy.
... View more
06-11-2019
10:05 PM
|
0
|
2
|
1908
|
|
POST
|
Maybe you can try the following code to update the domain values of a service Try it on a test service before updating your production service. item = gis.content.get('ItemID')
#get the FeatureLayerCollection
flc = FeatureLayerCollection.fromitem(item)
#define the update dictionary
update_dict = {
"fields": [
{
"name": "fieldx",
"domain": {
"type": "codedValue",
"name": "Signs",
"codedValues": [
{
"name": "Option A",
"code": "type_a"
},
{
"name": "Option B",
"code": "type_b"
},
{
"name": "Option C",
"code": "type_c"
}
]
}
}
]
}
#update the featureservice definition
flc.manager.update_definition(update_dict) Please let us know if it works.
... View more
06-11-2019
09:53 PM
|
0
|
1
|
3135
|
|
POST
|
I mean programmatically without using esri dijits (BasemapGallery, BasemapToggle). I tried something like map.setBaseMap("Satellite") which works for maps other than webmaps built in AGOL /Portal. It seems unreasonable if no API is available for such a common operation.
... View more
06-11-2019
06:13 PM
|
0
|
4
|
3666
|
|
DOC
|
Thank you for the feedback. This widget only saves the operation layers at the moment. I did have a quick investigate for the basemap function before. It may be not that hard to store the basemap in the session, but it is a bit tricky when you restore it and try to co-ordinate with the basemap widget. I'll look into this function in the future should a business case arises.
... View more
06-10-2019
05:32 PM
|
1
|
0
|
4175
|
|
DOC
|
Checkout this customized SaveSession widget: SaveSession that supports heavy map layers and imagery Layers
... View more
06-06-2019
07:26 PM
|
1
|
0
|
17349
|
|
DOC
|
Don't worry about pasting the code. I just extracted some code from my work and created a customized SaveSession Widget, and you should be able to use it to replace the original one, please check it out: SaveSession that supports heavy map layers and imagery Layers
... View more
06-06-2019
07:20 PM
|
2
|
0
|
17349
|
|
DOC
|
This widget is based on the original SaveSession Widget This customized edition will support: 1. Layer visibility for heavy map service layers with multiple sub layers 2. Imagery layer 3. Popup Information for the newly added layers (updated on 28/8/2019) An example of a loaded map session:
... View more
06-06-2019
07:07 PM
|
1
|
8
|
4727
|
|
POST
|
First, you need make sure every street is one feature (one polyline, you can merge multiple lines into one polyline using GIS tools ) Then you can use python to iterate the feature class and read the geometry of each feature, when you have access to the geometry, you can read the path and points in each feature. You should be able to do it using Python API, or ArcPy environment in one of the desktop product, say ArcMap, ArcCatalog or ArcGIS Pro. ArcPy maybe easier and more straight-forward as its Ployline class provides firstPoint and lastPoint properties. ArcPy Polyline Class help: https://pro.arcgis.com/en/pro-app/arcpy/classes/polyline.htm arcgis.geometry module: https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.geometry.html?highlight=geometry#module-arcgis.geometry
... View more
06-06-2019
05:07 PM
|
0
|
0
|
811
|
|
DOC
|
Hi Kevin I had a quick debug into your code, and I can see where the code stops Please declare the array here in the Widget.js : Good luck.
... View more
06-06-2019
03:27 PM
|
0
|
0
|
17349
|
|
BLOG
|
As a developer I used WAB Developer Edition on two occasions in the last 3 years. Here are some of my thoughts. 1. Some important functions are missing in the out-of-box widgets. just think what you will do on the digital map: I will select features (by attribute or by interacting with the map), add / remove the new selection to / from my existing selection. But the Select Widget does none of this. and the Select widget only works for visible feature layers, no tricks can be done on the map service to make it seemingly selectable. 2. Actually the Query widget is more like a selection widget if a confusing and useless (most of time) temporary layer not being created for every query. Can't we just create a temporary memory layer which is managed by the application rather than by the user?? Most of user don't even know a layer is created for this operation. If I need my users to select on the map service (better performance in some cases, advanced cartography), I have to let them do a query first before they can select, what?? 3. There are no Select By Attribute function. Instead, they provide two filter widgets , Filter and Group Filter. But sometimes I need simply select and highlight features rather than aggressively filter out other features. don't we do this all the time in the desktop GIS? 4. If I am not happy with the existing features / lack of features, I can always customize existing widgets, since I can write code and I have a WAB Developer Edition. right? I have to say I did get some good stuff done, but I don't like the experience. The main problem is the documentation for the JIMU architecture and its detailed API reference. It was so poor and out-dated that I had to read thousands of line of code to figure out how to add tens of lines of code of my own! I've been a developer on ESRI platform for quite long time, I feel the quality of the help document is not on par with other ESRI product for developers --- It lacks details. Developers need details, because their work are like under microscope. 5. I noticed there are many new widgets released since I first used it 3 years ago, but most of these are not useful for my projects. Let's go back to the basic widgets that everyone uses and bring back the consistent user experience that ESRI has established in their desktop products. how about starting with comprehensive selection function and doing stats/reports on arbitrary selections? and giving the developers stronger support by providing good documentation and examples if we are going to continue the Developer Edition. I can't help thinking the Flex Viewer days, the application architecture was elegant and well-documented, so did the APIs, the spirit of the developer community were high... OK, have to get over it now I am not all negative about WAB, quite opposite actually, I like WAB in portal and ArcGIS Online, which provides great flexibility when sharing your maps. Just my expectation for the Developer Edition is much higher than that for the WAB online version.
... View more
06-05-2019
11:41 PM
|
9
|
13
|
7524
|
|
DOC
|
Hi John, Hope you've figured it out. otherwise please see if my latest response to Kevin MacLeod can help you out. Cheers
... View more
06-05-2019
09:45 PM
|
1
|
0
|
17349
|
|
DOC
|
Hi Kevin Please try the following steps. 1. Declare an array to store the added layers (layer IDs). because I have the Add Data widget, so there will be added layers to the default web map. in different sessions the user may have very different layers added to the map, so I need to remove all these added layers in the current session before I load a new session. I don't reload the webmap, because this will cause failure in all loaded widgets since they are tied to the current map object. 2. Replace the loadSession function with the following one in Widgets.js: loadSession: function (sessionToLoad) { // zoom the map if (sessionToLoad.extent) { extentToLoad = new Extent(sessionToLoad.extent); this.map.setExtent(extentToLoad).then(function () { console.log('SaveSession :: loadSession :: new extent = ', extentToLoad); }, function () { var msg = new Message({ message: string.substitute("An error occurred zooming to the ${name} map.", sessionToLoad), type: 'error' }); }); } //remove the layers added in the current map theMap = this.map; if (this.addedLayers.length>0){ this.addedLayers.forEach(function(layerId){ lyr = theMap.getLayer(layerId); theMap.removeLayer(lyr); }); } //clear the previously added layerIDs this.addedLayers=[]; // toggle layers if (sessionToLoad.layers) { //this.setLayersOnMap(sessionToLoad.layers); theWidget = this;//save "this" context in a local variable, in case the context changes in the callbacks. //make sure all the added layers are loaded before retrieving the new layerInfos, //replace the current layerInfos with the new layerInfos this.mySetLayersOnMap(sessionToLoad.layers).then(function(flags){ var newLayerInfos = LayerInfos.createInstance(theWidget.map); LayerInfos.setInstance(theWidget.map,newLayerInfos); //change layer visisbilities in the layerlist theWidget.layerInfosRestoreState(sessionToLoad.layerOptions); //this will make sure the layerlist always shows the correct layers and sublayers of the added layer theWidget.refreshLayerList(newLayerInfos); }); } // fire custom event topic.publish("SaveSession/SessionLoaded", sessionToLoad); console.log('SaveSession :: loadSession :: session = ', sessionToLoad); }, Sorry, I've lost all the formatting of the code here, please reformat it in your Javascript editor, then it should look much better and less scary 3. Paste all the supporting functions after the loadSession function. /** * restore the layer visisbilities * @param array of layer visisbilities * by simoxu */ layerInfosRestoreState: function (layerOptions) { var layerInfosObj = LayerInfos.getInstanceSync(); var layers = {}; if (layerOptions) { for (var key in layerOptions) { if (layerOptions.hasOwnProperty(key)) { var layer = layerOptions[key]; var visible = false; if ("undefined" === typeof layer.visible) { visible = layer.selected;//turn .selected to .visible } else { visible = layer.visible;//keep: layers[key].visible } layers[key] = { visible: visible }; } } layerInfosObj.restoreState({ layerOptions: layers }); } else { //keep current visibility } }, refreshLayerList: function(operLayerInfos) { var wman = this.widgetManager; if (wman) { layerListWidget = wman.getWidgetByLabel("Layer List"); if (layerListWidget) { layerListWidget.operLayerInfos = operLayerInfos; layerListWidget._refresh(); } } }, mySetLayersOnMap: function (settings) { //var allDynamicLayersReadyDefs = new Deferred(); var layersLoadedDefs = []; //var layerLoadedFlag; var layer; var len = settings.length; array.forEach(settings, lang.hitch(this,function(layerSettings,index) { var layer layer = this.map.getLayer(layerSettings.id); if (!layer) { layer = this.addLayerToMap(layerSettings); layer._layerLoadedFlag = new Deferred(); layersLoadedDefs.push(layer._layerLoadedFlag); //record the layers added on top the intial Web Map this.addedLayers.push(layerSettings.id); var theMap = this.map; var theOrder = layerSettings.order; layer.on("load",function(e){ e.layer._layerLoadedFlag.resolve("loaded!"); //set the order again after the layer loaded theMap.reorderLayer(e.layer,theOrder); delete e.layer._layerLoadedFlag;//it seems that deleting the temprary property here won't affect the Deferred. by simoxu }); } else { this.map.reorderLayer(layer,layerSettings.order) } })); return all(layersLoadedDefs).then(function(flags){ return flags; }); }, 4. Optional. if you want it to support imagery layers, you need replace the addLayerToMap function withe the following one: /** * create a new map layer with the given settings * @param {Object} layerSettings settings for the layer * @return {Object} layer oject */ addLayerToMap: function (layerSettings) { console.log('SaveSession :: addLayerToMap :: adding layer = ', layerSettings); var layer, options; switch (layerSettings.type) { case "ArcGISDynamicMapServiceLayer": options = lang.clone(layerSettings.options); options.imageParameters = new ImageParameters(); lang.mixin(options.imageParameters, layerSettings.options.imageParameters); layer = new ArcGISDynamicMapServiceLayer(layerSettings.url, options); //layer = new ArcGISDynamicMapServiceLayer(layerSettings.url); console.log('SaveSession :: addLayerToMap :: created ArcGISDynamicMapServiceLayer layer = ', layer); break; case "FeatureLayer": layer = new FeatureLayer(layerSettings.url, layerSettings.options); console.log('SaveSession :: addLayerToMap :: created Feature layer = ', layer); break; case "ArcGISTiledMapServiceLayer": layer = new ArcGISTiledMapServiceLayer(layerSettings.url, layerSettings.options); console.log('SaveSession :: addLayerToMap :: created ArcGISTiledMapServiceLayer layer = ', layer); break; case "ArcGISImageServiceLayer": layer = new ArcGISImageServiceLayer(layerSettings.url,layerSettings.options) break; default: console.log('SaveSession :: addLayerToMap :: unsupported layer type = ', layerSettings.type); break; } if (layerSettings.name) { layer.name = layerSettings.name; } // The bottom most layer has an index of 0. this.map.addLayer(layer, layerSettings.order); console.log('SaveSession :: addLayerToMap :: created layer for ', layer.id, ' using settings = ', layerSettings); return layer; }, Because I changed this widget quite a bit to suit my particular application needs, It might not be a perfect fit in your application. But, I hope this at least can provide some clue to help you to find a better solution if it does not work straight away. Good luck. Simo
... View more
06-05-2019
09:41 PM
|
1
|
0
|
17349
|
|
POST
|
With ESRI Vector Basemap, this restriction should be lifted. I haven't tested anything, but I feel it should not be a problem (pixelation) when you have the data loaded in the browser, theoretically speaking.
... View more
04-09-2019
11:44 PM
|
0
|
0
|
3742
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-28-2019 05:13 PM | |
| 1 | 02-25-2019 04:54 PM | |
| 1 | 03-05-2019 02:08 PM | |
| 1 | 03-12-2019 10:20 PM | |
| 1 | 11-27-2024 04:36 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-17-2025
07:39 AM
|