POST
|
Hello, I've investigated the "Vector Field Renderer" raster processing template in the past with the "old" Enterprise Map Viewer and Web App Builder. https://community.esri.com/t5/arcgis-enterprise-portal-questions/image-layer-with-vector-field-renderer-asks-to/m-p/1031436 Now we want to move over to the new Map Viewer (still Beta for Portal) and Experience Builder. Our workflow uses the ArcGIS Python API to publish an Image Services to the Portal Hosting Server. The new Image Service than get's registered to the portal. In our first version I had to do a lot of things to make the old map viewer show the image service with vector field renderer per default. 1. My data is a single band raster with only information on direction, so I needed to create a constant raster for magnitude and combined them to a 2-band raster 2. Setting the mosaic dataset source data type to "VECTOR_MAGDIR" processing_template = "path_to_raster_function_template.rft.xml"
set_md_infos_result = arcpy.SetMosaicDatasetProperties_management(
mosaic_dataset, data_source_type="VECTOR_MAGDIR" if is_two_banded
else "GENERIC", processing_templates=";".join(["None",
processing_template], default_processing_template=processing_template) 2. Adding a raster function template Now with the current setup it seems like I don't need a raster function anymore. I only set the mosaic dataset source to "VECTOR_MAGDIR" and it already uses Vector Field Renderer in the Map Viewer Beta. But this is really confusing. What is the Vector Field Raster Function then used for? It seems like most of the clients ArcGIS Pro and the new Map Viewer have own implementations of vector field renderer. Does someone have experience with that? It would be really nice to have a clear workflow from mosaic dataset creation, image service publishing and displaying in new map viewer. Please, any help is really appreciated 🙂
... View more
11-02-2021
09:06 AM
|
0
|
0
|
861
|
POST
|
Hello, with our current on-premise Portal for ArcGIS it is possible to add Image Layer Items to the web map. However the "Style" option ist still disabled for image layers. Without using ArcGIS Online, from the docs it seems like the SaaS version already has this feature: https://doc.arcgis.com/de/arcgis-online/create-maps/style-imagery-mv.htm Is it expected to be included in the next portal release (10.10)? Or will there be a new beta release for 10.9 earlier? Thank you for your help :)!
... View more
11-02-2021
08:36 AM
|
0
|
2
|
1325
|
POST
|
I've been able now to accomplish my goal and to add a new group layer with existing feature layers to my web map item. Unfortunatly for this you need to write dictionaries that correspond to Esri web map specification (GroupLayer, FeatureLayer ... ) https://developers.arcgis.com/web-map-specification/objects/groupLayer/ Here are the major parts: def create_layer_id(layerIndex):
return ''.join(random.choices(string.ascii_lowercase + \
string.digits, k=11)) + "-layer-" + str(layerIndex)
# This is my base webmap (template)
map_template = gis.content.get('3095cb51e2a44e818b90608c487f8b3b')
# Copy template to new web map item into subfolder
project_map = WebMap(map_template).save({
"title": "project map",
"snippet": "some description",
"tags": "maps"}, folder="project_folder")
# Create a new group layer following esri web map specification
group_layer = {
"id": create_layer_id(random.randint(10000, 99999)),
"layers": [],
"layerType": "GroupLayer",
"title": "my new group layer" }
# Get an existing feature service / layer collection item
# get_item() is standard portal item query logic
lyr_item = get_item(lyr_name, "Feature Service", "test")
# Create feature layer following esri web map specification
feature_layer = {
"id": create_layer_id(random.randint(10000, 99999)),
"url": lyr_item.layers[0].url,
"title": lyr_item.layers[0].properties.name,
"itemId": lyr_item.id,
"layerType": "ArcGISFeatureLayer" }
# Add feature layer to group layer
group_layer["layers"].append(feature_layer )
# Update project map with new group layer
map_def = project_map.get_data()
map_def["operationalLayers"].append(group_layer)
project_map.update({'text': str(map_def)}) Maybe this will help someone 🙂
... View more
10-29-2021
01:41 AM
|
2
|
1
|
3251
|
POST
|
map_item["operationalLayers"] Hi, I have a very general question this time. The Esri arcgis API is meant to be THE tool to automate workflows and to interact with ArcGIS Portal. But there seem to be a lot of features that are not implemented yet, in my case map authorization. I have the new webmaps (next gen) and map viewer beta. I can interact with web maps v2 also from the Python API. But I can't create a group layer with API methods. I can do: map_item.get_data() I see my GroupLayer in the map layers: map_item["operationalLayers"] [
{
"id": "htsews6tyu0-layer-10010",
"title": "DummyGroup",
"layers": [
{
"id": "17cc733308b-layer-3",
"title": "FeatureLayer1",
"url": "some-feature-server-url",
"itemId": "d77d046fb6de424da2258a08b376f1fc",
"layerType": "ArcGISFeatureLayer",
"popupInfo": {
"popupElements": [
{
"type": "fields"
}
],
"showAttachments": True,
"fieldInfos": [
{
"fieldName": "objectid",
"label": "OBJECTID",
"visible": False
}
],
"title": "Titel1"
}
},
{
"id": "17cc7332022-layer-2",
"title": "FeatureLayer2",
"url": "some-feature-server-url",
"itemId": "3efe6ee7327e49e59a37406f622db492",
"layerType": "ArcGISFeatureLayer",
"popupInfo": {
"popupElements": [
{
"type": "fields"
}
],
"showAttachments": True,
"fieldInfos": [
{
"fieldName": "objectid",
"label": "OBJECTID",
"visible": False
}
],
"title": "Titel2"
}
}
],
"layerType": "GroupLayer"
}
] Now I can get portal Feature Service items and it's FeatureLayer items and I want to: 1. add another Feature Layer to map_item["operationalLayers"][0]["layers"] 2. or add another group layer with x feature layers We really need operations for the Python API to compose a webmap and its layers from existing layer items.
... View more
10-28-2021
07:58 AM
|
0
|
2
|
3271
|
POST
|
Okay, I found the mistake. I had an invalid layer in my template map. The invalid layer was the result of trying to create a new group layer programmatically. Without the invalid layer there are several ways to achieve the copy webmap task. Here is one that I'm using now and which is working for me: # This is my base webmap (template)
map_template = gis.content.get('some_item_id')
# Copy template to new web map item into subfolder
project_map = WebMap(map_template).save({
"title": "project map",
"snippet": "some description",
"tags": "maps"}, folder="project_folder")
... View more
10-28-2021
06:56 AM
|
0
|
0
|
4711
|
POST
|
Okay all 3 approaches have the same result BUT I forgot to mention that in all three cases the web map copy get's created in the other folder only in my jupyter notebook I get the strange python error. Portal logs looking okay. Item created successfully. So it seems to be a communication problem between arcgis python API and the portal. Also the error is raised in _connection.py!
... View more
10-28-2021
04:26 AM
|
0
|
0
|
4722
|
POST
|
3. Option now clone_results = WebMap(map_template).save({"title": "ABC", "snippet": "XYZ", "tags": "abc"}, folder="test") Exact same result... okay it must be something else related to our portal... I'll investigate this.
... View more
10-28-2021
04:17 AM
|
0
|
0
|
4722
|
POST
|
Function item.copy_item() is not available in 1.8.5 and I dont know how I can get the latest 1.9.1 version because I'm using ArcGIS Pro environment clone and latest Pro version 2.8.3 only supports 1.8.5. item.copy() doesn't seem to be appropriate for what I'm trying to achieve.
... View more
10-28-2021
04:09 AM
|
0
|
1
|
4722
|
POST
|
Hi @CarstenB_orsted, I believe, you're right in this points. I came to the same conclusion when browsing online materials: I also tested following way: map_json = json.dumps(map_template.get_data(try_json=True))
project_map = gis.content.add({"title": "ABC", "type": "Web Map", "snippet": "ABCD", "tags": "XYZ", "text": map_json}, folder="test") Exact same result here! I'll also try your version as wll now.
... View more
10-28-2021
03:58 AM
|
0
|
0
|
4724
|
POST
|
Hi, can someone tell me how I can copy or clone a "Web Map" item from my user root folder into another folder? I have ArcGIS Pro 2.8.3 installed and arcgis API version 1.8.5 (latest I can get). I tried clone_results = gis.content.clone_items(items=[map_template], folder="test") and yes, map_template is really the web map item in my root folder and "test" exists. I get an error: Exception Traceback (most recent call last) ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self) 2423 # Add the new item -> 2424 new_item = self._add_new_item(item_properties) 2425 ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in _add_new_item(self, item_properties, data) 1208 -> 1209 new_item = self.target.content.add(item_properties=item_properties, data=data, thumbnail=thumbnail, folder=self.folder, owner=self.owner) 1210 self.created_items.append(new_item) ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in add(self, item_properties, data, thumbnail, metadata, owner, folder, item_id) 4264 thumbnail, metadata, -> 4265 owner_name, folder) 4266 ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_portalpy.py in add_item(self, item_properties, data, thumbnail, metadata, owner, folder) 354 path += '/addItem' --> 355 resp = self.con.post(path, postdata, files) 356 if resp and resp.get('success'): ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in post(self, path, params, files, **kwargs) 719 try_json=try_json, --> 720 force_bytes=kwargs.pop('force_bytes', False)) 721 #---------------------------------------------------------------------- ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in _handle_response(self, resp, file_name, out_path, try_json, force_bytes) 513 errorcode = data['error']['code'] if 'code' in data['error'] else 0 --> 514 self._handle_json_error(data['error'], errorcode) 515 return data ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py in _handle_json_error(self, error, errorcode) 535 errormessage = errormessage + "\n(Error Code: " + str(errorcode) +")" --> 536 raise Exception(errormessage) 537 #---------------------------------------------------------------------- Exception: Unable to generate dependencies Unable to generate dependencies (Error Code: 500) During handling of the above exception, another exception occurred: _ItemCreateException Traceback (most recent call last) <ipython-input-5-dd6b2e4b5b45> in <module> 100 101 # Copy template map to new item in project folder --> 102 clone_results = gis.content.clone_items(items=[map_template], folder="test") 103 104 print(clone_results) ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in clone_items(self, items, folder, item_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner) 5515 owner_name = owner.username 5516 deep_cloner = clone._DeepCloner(self._gis, items, folder, wgs84_extent, service_extent, use_org_basemap, copy_data, copy_global_ids, search_existing_items, item_mapping, group_mapping, owner_name) -> 5517 return deep_cloner.clone() 5518 5519 def bulk_update(self, itemids, properties): ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self) 811 else: 812 with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: --> 813 results = executor.submit(self._clone, executor).result() 814 return results 815 ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\_base.py in result(self, timeout) 433 raise CancelledError() 434 elif self._state == FINISHED: --> 435 return self.__get_result() 436 else: 437 raise TimeoutError() ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc) ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in _clone(self, excecutor) 798 if item: 799 item.delete() --> 800 raise ex 801 802 level += 1 ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\concurrent\futures\thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc) ~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\common\_clone.py in clone(self) 2429 return new_item 2430 except Exception as ex: -> 2431 raise _ItemCreateException("Failed to create {0} {1}: {2}".format(original_item['type'], original_item['title'], str(ex)), new_item) 2432 2433 _ItemCreateException: ('Failed to create Web Map vorlage-karte: Unable to generate dependencies\nUnable to generate dependencies\n(Error Code: 500)', None) I already reinstalled my whole ArcGIS Pro and conda/python environment, error remains. Any ideas?
... View more
10-28-2021
02:44 AM
|
0
|
6
|
4735
|
POST
|
I've been able to resolve the public URL for our internal tests so the name resolution error is gone. But now there seems to be another issue with the WMSLayer(). I'm passing the whole WMSLayer to map.add_layer() at the moment. <ipython-input-67-6b3ee09406c0> in map_add_layer(map, layer, options)
1 def map_add_layer(map, layer, options):
----> 2 map.add_layer(layer, options=options)
3
4 if map_layers[0].isWebLayer and "wms" in map_layers[0].dataSource.lower():
5 # Try to find WMS in portal sources
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\lib\site-packages\arcgis\mapping\_types.py in add_layer(self, layer, options)
426 return True
427 elif isinstance(layer, BaseOGC):
--> 428 lyr = layer._lyr_json
429 title = lyr["title"]
430 opacity = lyr["opacity"]
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\lib\site-packages\arcgis\mapping\ogc\_wms.py in _lyr_json(self)
198 "url" : self._url,
199 "version" : self._version,
--> 200 "sublayers" : [{'name' : lyr.Name} for lyr in self.layers],
201 "minScale" : self.scale[0],
202 "maxScale" : self.scale[1],
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone1\lib\site-packages\arcgis\mapping\ogc\_wms.py in <listcomp>(.0)
198 "url" : self._url,
199 "version" : self._version,
--> 200 "sublayers" : [{'name' : lyr.Name} for lyr in self.layers],
201 "minScale" : self.scale[0],
202 "maxScale" : self.scale[1],
AttributeError: 'str' object has no attribute 'Name' Am I doing anything wrong? Why are there internal type conflicts in WMSLayer object? It's an ArcGIS Server WMS with Esri Python API.
... View more
10-26-2021
02:39 AM
|
0
|
1
|
5147
|
POST
|
Hi, I'm connecting to our on premise Portal, only available in our network, so I don't use proxy. gis = GIS(portal_url, username, portal_user_password, verify_cert=False) connection works After that I'm creating a new web map new_map = WebMap() works Now I'm querying an item from our portal which is of type "WMS". This works as well but the WMS has an Internet URL. Now I want to add this Internet WMS to my webmap: wms_layer = WMSLayer(wmslayer[0].url) works But when I do new_map .add_layer(wms_layer.layers[0]) I get an error: A connection error has occurred: HTTPSConnectionPool(host='our.internet.domain', port=443): Max retries exceeded with url: /arcgis/services/wms/some_service/MapServer/WMSServer?service=WMS&request=GetCapabilities&version=1.3.0&token=short-live-token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A3853E41C8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')) How can I tell urlllib3 or the arcgis API to use proxy on specific requests but not for my portal itself?
... View more
10-25-2021
06:09 AM
|
0
|
2
|
5175
|
POST
|
I was able to get this to work but I had to overcome a couple of problems. The main problem was indeed thread related. The MapViewOverlayControl needs to be created on the main/UI thread. Furthermore the AddOverlayControl and RemoveOverlayControl methods need to be called on the same thread where the control has been created. My solution is now a little heavy. I create the control when my map view is initialized. _courseEndOverlay =
new MapViewOverlayControl(new CourseEndMessageControlView(), true, true,
true, OverlayControlRelativePosition.Center, 0.5, 0.5); It sends a message from inner thread to outer with delegate callback but then I'm still not exactly on the same thread as my control ... so I need System.Windows.Application.Current.Dispatcher.Invoke((Action)delegate {
_logger.Debug("show course end control");
MapView.Active.AddOverlayControl(_courseEndOverlay);
});
await QueuedTask.Run(() => {
Task.Delay(4000).Wait();
System.Windows.Application.Current.Dispatcher.Invoke((Action)delegate {
MapView.Active.RemoveOverlayControl(_courseEndOverlay);
});
});
... View more
08-25-2021
06:41 AM
|
0
|
0
|
3496
|
POST
|
Hi @Wolf, I added my relevant code under the first answer above. From my point of view that looks like what the documentation links contain. We are at SDK version 2.4 and Pro version 2.4.1, due to customer decisions. Makes this a difference? Is my thread/task management the problem?
... View more
08-25-2021
12:08 AM
|
0
|
1
|
3507
|
Title | Kudos | Posted |
---|---|---|
1 | 01-23-2020 06:28 AM | |
1 | 06-04-2018 11:48 PM | |
1 | 06-04-2018 06:16 AM | |
2 | 10-29-2021 01:41 AM | |
1 | 01-22-2018 07:22 AM |
Online Status |
Offline
|
Date Last Visited |
08-15-2022
08:13 AM
|