|
POST
|
Hi Trevor, Try approaching it this way: Create the Web Map manually exactly as you want it to appear. Save the Web Map and make a note of the Item ID that is generated. Optional: share the Web Map publicly - you don't have to, it just makes the next step easier since you won't require a token. You can unshare/delete the Web Map when you're done. If this is a Portal Web Map, go to https://machine.domain/portal/sharing/rest/content/items/<itemID>/data. For ArcGIS Online this will be: https://www.arcgis.com/sharing/content/items/<itemID>/data You'll need to append a token (?token=<token>) to the URL if you didn't share publicly. The result will be the JSON you need to be using for the Item Properties text value.
... View more
03-14-2019
12:36 PM
|
0
|
0
|
5910
|
|
POST
|
Hi Egge-Jan, It was my pleasure to help out and thank you for sharing the end product. Please go ahead and mark this one answered for anyone who might be interested in the workflow. Kind regards, Earl
... View more
03-14-2019
08:01 AM
|
1
|
0
|
3729
|
|
POST
|
Hi Trevor, Do you have this working with addItem? I ask because I'm not certain that you can add a Web Tiled Layer as an Item - that seems to be one of the types that you can only add when you're in the Map Viewer. I don't see anywhere that you can set the required x, y, z values when adding as an item. In that case, you may have to settle for adding the Web Tiled Layer to a Web Map like so: from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com","user","pass")
# This is the JSON used to create the Web Map, which includes a default basemap and a sample Web Tiled Layer
data={"operationalLayers":[{"templateUrl":"https://{subDomain}.tile.thunderforest.com/cycle/{level}/{col}/{row}.png",
"copyright":"Maps © <a href='https://www.thunderforest.com'>Thunderforest<\/a>, Data © <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap contributors<\/a>",
"fullExtent":{"xmin":-2.0037508342787E7,"ymin":-2.003750834278E7,"xmax":2.003750834278E7,"ymax":2.0037508342787E7,
"spatialReference":{"wkid":102100}},"subDomains":["a","b","c"],"id":"WebTiled_7161","title":"OpenCycleMap","type":"WebTiledLayer",
"layerType":"WebTiledLayer","visibility":True,"opacity":1}],"baseMap":{"baseMapLayers":[{"id":"defaultBasemap",
"layerType":"ArcGISTiledMapServiceLayer","url":"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",
"visibility":True,"opacity":1,"title":"Topographic"}],"title":"Topographic"},"spatialReference":{"wkid":102100,"latestWkid":3857},
"authoringApp":"WebMapViewer","authoringAppVersion":"4.3","version":"2.1"}
# Fill this out as you see fit, the key part is the "text" attribute
item_properties_dict = {"type": "Web Map","title": "Test Map","tags": ["WebTiledLaye","pythonapi"],"snippet":"", "text":data}
newmap = gis.content.add(item_properties = item_properties_dict)
newmap
... View more
03-13-2019
06:19 AM
|
0
|
0
|
5910
|
|
POST
|
Hi Andrew, I think this is what you're after: ^AW.* Where: ^AW = starts with 'AW' .* = any character with 0 or more repetitions Hope this helps!
... View more
03-12-2019
08:00 AM
|
0
|
0
|
1120
|
|
POST
|
Hi Gerco, I don't run into any issues running the code - it grabs 4 features from the one layer and adds them to the second. For reference, I ran this code with the token part removed as you shared the services publicly: import json, requests
url = r"https://services9.arcgis.com/ty0YDnowzprP81CR/ArcGIS/rest/services/testlayer/FeatureServer/0"
url_query = r"https://services9.arcgis.com/ty0YDnowzprP81CR/ArcGIS/rest/services/testlayer/FeatureServer/0/query"
feature_querystring = {"where": "1=1",
"objectIds": "",
"outFields": "*",
"returnGeometry": "true",
"f": "json"}
response_featuredata = requests.request("GET", url_query, params=feature_querystring)
response_featuredata_dict = response_featuredata.json()
features = response_featuredata_dict["features"]
# copy to featureservice 2
add_features_url = r"https://services9.arcgis.com/ty0YDnowzprP81CR/arcgis/rest/services/testlayer2/FeatureServer/0/addFeatures"
params = {
"features": json.dumps(features),
"f": "pjson"
}
response = requests.post(url=add_features_url, params=params)
print(response)
print(response.text)
... View more
03-12-2019
07:43 AM
|
1
|
2
|
3594
|
|
POST
|
I see. Just to confirm, you are working with a Hosted Feature Layer correct?
... View more
03-12-2019
07:24 AM
|
0
|
1
|
1999
|
|
POST
|
If this is possible (haven't checked) and you were able to add them, I suspect that update_definition is what you're after. This should correspond to the REST API operation of the same name which I believe is used for the purpose.
... View more
03-11-2019
05:05 PM
|
0
|
3
|
1999
|
|
POST
|
Hi Egge-Jan, Thank you for sharing that blog spot here and I hope it was useful to you! Essentially, when you set an area of interest the updateDefinition operation is executed on the view layer (https://whatever.domain.com/arcgis/rest/admin/services/worldEQView/FeatureServer/0/updateDefinition) That request looks something like this, with the viewLayerDefintion property being updated: {"viewLayerDefinition":{"filter":{"operator":"esriSpatialRelIntersects","value":{"geometryType":"esriGeometryEnvelope","geometry":{"xmin":4485937.7074932605,"ymin":1543545.165101517,"xmax":9417043.276225261,"ymax":6239836.182941515,"spatialReference":{"wkid":102100,"latestWkid":3857}}}}}} Here you see that the Area of Interest is really just an envelope which intersects the view. So, the trickiest part is probably knowing the geometry to supply. To accomplish this with the Python API, you use FeatureLayerManager's update_definition: arcgis.features.managers module — arcgis 1.6.0 documentation Something like this will accomplish the desired result: from arcgis import GIS
gis = GIS("https://machine.domain.com/portal", "user", "pass")
url = 'https://machine.domain.com/arcgis/rest/services/viewLayer/FeatureServer/0'
fs = arcgis.features.FeatureLayer(url, gis)
update_dict = {"viewLayerDefinition":{"filter":
{"operator":"esriSpatialRelIntersects","value":
{"geometryType":"esriGeometryEnvelope","geometry":
{"xmin":4485937.7074932605,"ymin":1543545.165101517,
"xmax":9417043.276225261,"ymax":6239836.182941515,
"spatialReference":{"wkid":102100,"latestWkid":3857}}}}}}
fs.manager.update_definition(update_dict) Kind regards, Earl
... View more
03-11-2019
05:00 PM
|
5
|
3
|
3729
|
|
POST
|
Hi there. It would be helpful to know what the value is for: features = response_featuredata_dict["features"] This will work: import requests, json
payload = {'features': '[{"geometry":{"x":-9969835.864784643,"y":6707017.275694676,"spatialReference":{"wkid":102100}},"attributes":{"phone":null,"email":null,"note":null,"link":null,"name":null}}]','f':'json'}
resp = requests.post('https://sampleserver6.arcgisonline.com/arcgis/rest/services/Notes/FeatureServer/0/addFeatures', payload)
data=resp.json()
print(data) But seems like your query would return something like this: [ { "attributes": { "placename": "Tom's Toys" }, "geometry": { "x": 1036256.7442350946, "y": 1860503.3023153618 } }
]
You would need to be supplying this for addFeatures to work in my example:
[{"attributes":{"phone":null,"email":null,"note":null,"link":null,"name":null}},{"geometry":{"x":-9969835.864784643,"y":6707017.275694676,"spatialReference":{"wkid":102100}}}] So, maybe you're missing some braces around the geometry.
... View more
03-08-2019
01:58 PM
|
0
|
4
|
3594
|
|
POST
|
I'm not positive of an out-the-box solution, but conceptually you should be able to create a lightweight application that: Obtains the token Sends a request to the website with the required token Sends the response to GeoEvent In that case, you'd use the 'Receive JSON on a REST Endpoint' input connector.
... View more
03-04-2019
03:07 PM
|
1
|
3
|
5481
|
|
POST
|
That may be your problem - you need an Image Server license to publish a Mosaic Dataset either as a Map Service or an Image Service: How To: Publish a mosaic dataset to ArcGIS Server
... View more
03-04-2019
01:33 PM
|
0
|
1
|
2230
|
|
POST
|
What do you mean its not working properly in ArcCatalog? Let's take a step back - does time show correctly on the client-side (ArcMap, ArcGIS Pro)?
... View more
03-01-2019
11:02 AM
|
0
|
3
|
2230
|
|
POST
|
Hi, A bit more context would help - do you mean that you're polling a secured external website for JSON?
... View more
03-01-2019
10:58 AM
|
0
|
5
|
5481
|
|
POST
|
Chaim, Are you by any change copying between versions? I was able to reproduce that error between 10.4.1 and 10.6.1.
... View more
02-28-2019
11:53 AM
|
0
|
2
|
3892
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 01-18-2024 01:34 PM | |
| 1 | 09-13-2023 06:48 AM | |
| 1 | 09-23-2022 09:04 AM | |
| 1 | 06-14-2024 01:14 PM | |
| 2 | 09-24-2019 08:22 AM |