|
POST
|
I've used concurrent.futures and asyncio with decent results. Both are significantly faster than doing it one at a time. The basic requirements are that you just get a list of all the attachments you need to download, feed them into your download function, and you're good to go. The only thing you have to be careful about is the token as that willl eventually time out - simply refresh the token before the expirtation time.
... View more
11-06-2023
06:19 AM
|
0
|
0
|
1116
|
|
POST
|
I believe the expected URL is in fact in that format. Perhaps you can manually set the redirect uri and see if that does anything?
... View more
11-02-2023
03:21 PM
|
1
|
6
|
6417
|
|
POST
|
My suggestion is to open a quick case with technical support and check if they have this logged as a bug and, if not, go ahead and log one.
... View more
11-01-2023
06:48 AM
|
1
|
0
|
1659
|
|
POST
|
Hey, I get this: Location: Jalan Jabatan Perhutanan, Keningau, Bahagian Keningau, 89000, Sabah, MYS
KODDUN: N.40, NAMADUN: BINGKOR, PARLIMEN: KENINGAU
KODDUN: N.40, NAMADUN: BINGKOR, PARLIMEN: KENING
... View more
11-01-2023
06:47 AM
|
0
|
2
|
2175
|
|
POST
|
There's probably a lot in the API you just don't need that will add a lot size and introduce a few problems. I would consider the pieces you actually a need and maybe write something custom (if it's going to get repeated use) or else see how far you can get with the --no-deps option when installing.
... View more
10-31-2023
06:05 PM
|
1
|
0
|
1690
|
|
POST
|
Hello, If I understand what you are trying to do correctly, you are quite close and just need to add a geometry function to figure out if the input point is within the geometry. You may use Geometry (which will parse the type for you), but I will use Polygon and Point so it is more explicit what is going on. I'm not sure what the intention was with the else statement, so you may need to adjust further: from arcgis.gis import GIS
import arcgis
from arcgis.geometry import Point, Polygon
from arcgis.geocoding import reverse_geocode
gis = GIS()
webmap_item_id = "0c7d9a944a5a476694a2f998d53e3e1e"
webmap_item = gis.content.get(webmap_item_id)
webmap_data = webmap_item.get_data()
longitude = 116.157966
latitude = 5.341622
given_coord = {"x": longitude, "y": latitude, "spatialReference": {"wkid": 4326}}
point_geom = Point(given_coord)
location_details = reverse_geocode([longitude, latitude])
place_name = location_details.get("address", {}).get("LongLabel", "Unknown Location")
print(f"Location: {place_name}")
if 'operationalLayers' in webmap_data:
for layer in webmap_data['operationalLayers']:
if 'featureCollection' in layer:
for layer_collection in layer['featureCollection']['layers']:
for feature in layer_collection['featureSet']['features']:
attributes = feature['attributes']
geometry = feature['geometry']
koddun = attributes.get("KODDUN")
namadun = attributes.get("NAMADUN")
parlimen = attributes.get("PARLIMEN")
# Fetch GPS coordinates
if "rings" in geometry:
poly_geom = Polygon(geometry)
if point_geom.within(poly_geom):
print(f"KODDUN: {koddun}, NAMADUN: {namadun}, PARLIMEN: {parlimen}")
else:
print(f"KODDUN: {koddun}, NAMADUN: {namadun}")
... View more
10-31-2023
02:09 PM
|
0
|
4
|
2192
|
|
POST
|
If you can use Arcade, then you can do: Text($feature.DateField, 'MMM Y')
... View more
10-31-2023
06:22 AM
|
0
|
1
|
449
|
|
POST
|
Hi @TonyO . I looked into your problem and I have to admit I'm stumped. It looks like you're doing everything right. You said the code is honored but the UI does not update accordingly? Is that correct?
... View more
10-30-2023
02:54 PM
|
0
|
1
|
1687
|
|
POST
|
Out of curiosity, what sorts of things do you need to do? In the past, I ran into similar issues working with traffic data and the way I got around it was actually switching to Julia for the pre-processing tasks. Julia has a DataFrames.jl library that is similar to pandas.
... View more
10-27-2023
08:42 AM
|
0
|
0
|
7280
|
|
POST
|
Oh okay, great! Glad to hear you got something working.
... View more
10-25-2023
02:06 PM
|
0
|
0
|
1882
|
|
POST
|
Try something like this snippet as a test. It's absolutely not the most efficient way to do it but requires the least amount of change to your existing code. I tried to find the appropriate transformation WKID but came up short. It appears to do the projection, but I can't verify on my end. You'll just need to update the x/y to point to your data, as well as the attributes: from arcgis.features import FeatureSet
from arcgis.geometry import project
geometry = {
"x": -87.388224,
"y": 36.08589
}
new_geometry = project(geometries=[geometry], in_sr=4326, out_sr=103152)
point_dict = {
"features": [{
"attributes":{
"name": "test",
},
"geometry": new_geometry[0]
}]
}
fs = FeatureSet.from_dict(point_dict)
layer.edit_features(adds=fs) If this works, then maybe we can streamline things and switch to using a dataframe to do all the required projections at once.
... View more
10-25-2023
11:45 AM
|
0
|
0
|
1883
|
|
POST
|
The error is unexpected for what I think the cause is - I believe you are missing the required "role" parameter. Add another argument at the end equal to org_admin, org_publisher, or org_user and see if that works.
... View more
10-25-2023
08:43 AM
|
1
|
1
|
1953
|
|
POST
|
Hey, can you by any chance provide some sample longitude/latitude values from the data?
... View more
10-25-2023
08:34 AM
|
0
|
1
|
1892
|
|
POST
|
It looks like the problem is the logic as written doesn't incorporate paging. ViewManager.list() uses the relatedItems endpoint which itself does support paging. The supporting method that needs to be updated is related_items in arcgis/gis/__init__.py. You could fix it rather easily by introducing a while loop and adding "start" and "num" parameters in the postdata. The num value should be 100 based on what you've shared. If you decide to give this a try, I would recommend experimenting in a new python environment as changes to the source voids technical support. I've not tested this, but something like this should get you more or less started (you will need to open/save the file as an Administrator): def related_items(self, rel_type: str, direction: str = "forward"):
if rel_type not in self._RELATIONSHIP_TYPES:
raise Error("Unsupported relationship type: " + rel_type)
if not direction in self._RELATIONSHIP_DIRECTIONS:
raise Error("Unsupported direction: " + direction)
related_items = []
postdata = {"f": "json"}
postdata["relationshipType"] = rel_type
postdata["direction"] = direction
postdata["num"] = 100
postdata["start"] = 0
keep_going = True
while keep_going:
resp = self._portal.con.post(
"content/items/" + self.itemid + "/relatedItems", postdata
)
if len(resp["relatedItems"]) > 0:
postdata["start"] = postdata["start"] + 100
for related_item in resp["relatedItems"]:
related_items.append(Item(self._gis, related_item["id"], related_item))
else:
keep_going = False
return related_items In any case, I would recommend logging an enhancement with Esri Technical Support for paging to be added.
... View more
10-24-2023
12:56 PM
|
0
|
0
|
2610
|
|
POST
|
When I think running scripts as a service, I think of either AWS Lambda or Azure Functions. If you have access to either of those, then you can set one up fairly easily. In that scenario, the users hit an endpoint, some processing happens, a result is returned (the result of your script). Other options: If you have access to ArcGIS Notebook Server, you can save your script as a Jupyter Notebook (.ipynb) and upload. From there, users can run through Portal via ArcGIS Notebook Server. If you don't have access to ArcGIS Notebook Server, then they will need to download the notebook and run locally. You could set up your own Jupyter Notebook server and users can run the script(s) through there. You could upload the script as a text file (.py is not allowed) to your portal and share as an item. Then your users will have to download or copy/paste the code to execute.
... View more
10-23-2023
07:36 AM
|
1
|
0
|
1241
|
| 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 |