Comments (5)
thank you for your reply. In the end I want to update a webmap based on a json file, so saving it as a new one doesnt do the trick in my case. I'm looking forward to your workflow!
from arcgis-python-api.
@artsmax
There is no key "text" in the item properties that allows you to do this. I will try to find you a workflow and post it here.
But if you are simply trying to copy webmap1 into a new webmap then you can simply save() which will create a new webmap item and not update the original.
from arcgis-python-api.
@nanaeaubry , I would still like to see your workflow:) Are you able/willing to share? regards, Max
from arcgis-python-api.
@artsmax
Thanks for being patient! I got the update to work but have a few caviats to make you aware of as well.
Here is the code:
from arcgis.gis import GIS
from arcgis.mapping import WebMap
import json
gis = GIS(profile="your_online_profile")
# Get the two webmap items we want to use
item1 = gis.content.get("fa14b6470a8845aca963051e57c2f4bb")
item2 = gis.content.get("6093ff378f2546bea2159ab7beae0569")
# Use the data from symbol_webmap to update the basic_webmap
data = item2.get_data()
item1.update({"text":json.dumps(data)})
item1
You were on the right track to use the json data of the item and pass as text. However, the update should be done on the Item class and not the WebMap class. In the Item class we accept 'text' as a key in the item_properties dictionary.
This will work BUT it depends on your use case. I tested this where I had a feature layer in two different webmaps. In one webmap I left it as-is and in another I updated the symbology and saved it. Then when I did the update above the basic webmap got updated with the cool symbology.
This will work if you have the same feature layers in your webmap. This will not work if you have different feature layers and you want to apply the symbology of one layer to a totally different layer.
The reason is that the underlying structures are dictionaries. So this is a dictionary updating another dictionary and the rules for that apply. You might have to do a bit of manual search and replace if you want to apply to more complicated use cases.
Hope this helps jump start what you are trying to do! :) Good luck!
from arcgis-python-api.
thank you very much! Exactly what I was looking for:)
from arcgis-python-api.
Related Issues (20)
- Extract_Changes failing to return proper edit arrays HOT 3
- Feature Layer query() using return_all_records does not return all records HOT 5
- Esri job failed when using content.add() HOT 2
- ArcGIS API for Python StoryMaps v 2.3.0 Issues on StoryMap Publishing ("get" & "node" deprecation and content_list alternative) HOT 12
- _register_extension() method attached to incorrect Class - Service, not ServiceManager HOT 2
- FeatureSet to_geojson misformats MultiPolygons HOT 5
- Exception: Enter only compatible datasets from Labeled_Tiles, MultiLabeled_Tiles HOT 3
- requests > 2.31 breaks this packages connections to GIS(), causes maximum recursion HOT 7
- Feature Service Cloning renames Feature Service URL unnecessarily
- Bug running "Constructing drive time based service areas" python notebook as written HOT 1
- create_view method does not work on hosted feature layers if layer ids are not in sequential order. HOT 3
- item.usage() returns None when using a custom date range longer than 6 months HOT 1
- How to determine successful authentication? HOT 6
- Specify type in item_properties HOT 2
- User' object has no attribute 'availableCredits' HOT 2
- Error while trying to run Tensorflow backend in FeatureClassifier HOT 1
- clone_items() failing when item it pointing to a specific layer in feature service HOT 7
- ArcGis HOT 3
- - [checked] Have you followed the [contributing guidelines](https://github.com/github/opensource.guide/blob/HEAD/CONTRIBUTING.md)? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arcgis-python-api.