POST
|
Hmm, that error makes me think maybe the gdf needs a bit of cleanup before getting converted to a sedf? When does that error show up? On the publish attempt, or when trying to do the conversion?
... View more
02-12-2025
12:50 PM
|
0
|
0
|
611
|
POST
|
Hi, The way that I have done this in the past is like this: Create a spatially enabled dataframe from a geodataframe via geoaccessor's from_geodataframe Then, just publish using to_featurelayer() Something like this: from arcgis.features import GeoAccessor
sdf = GeoAccessor.from_geodataframe(you_gdf)
lyr = sdf.spatial.to_featurelayer("layer_name")
... View more
02-12-2025
06:26 AM
|
0
|
2
|
630
|
POST
|
I think the quickest way to get what you need is to just use geojson. I'm not sure if leafmap takes a geojson string, or dict but this should give you geojson string:
def read_fl(item_id):
living_atlas_item = gis.content.get(item_id)
feature_layer = living_atlas_item.layers[0]
fs = feature_layer.query(where="1=1", out_sr=4326)
return fs.to_geojson
If it requires a dict, then modify to this:
import json
def read_fl(item_id):
living_atlas_item = gis.content.get(item_id)
feature_layer = living_atlas_item.layers[0]
fs = feature_layer.query(where="1=1", out_sr=4326)
geojson_string = fs.to_geojson
return json.loads(geojson_string)
Per leafmap documentation, you should not have to create a gdf for this to work:
m = leafmap.Map(center=[0, 0], zoom=2)
in_geojson = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson"
m.add_geojson(in_geojson, layer_name="Cable lines")
... View more
11-19-2024
09:05 AM
|
2
|
1
|
1265
|
POST
|
From past experience, it is far easier and more reliable to do a truncate/add vs overwrite from a CSV. If you search truncate/append you will find numerous examples. Here's one: Solved: What is the recommended method to overwrite featur... - Esri Community
I suspect the problem you are encountering has to do with the format of the CSV data. In many cases, I've observed this behavior when a string exceeds the maximum length of a field - this is enough to derail the entire add operation. To isolate the problem with truncate/add, simply submit edits in small batches until you can narrow down the source.
... View more
11-04-2024
06:05 AM
|
0
|
0
|
417
|
POST
|
You can do this at least two ways:
Like this:
group_id = "1234_your_group_id_5678"
gis.content.search(query=f"group: {group_id}", item_type="Feature Service")
or like this:
group_id = "1234_your_group_id_5678"
group = gis.groups.get(group_id)
group.search(query="type:Feature Service")
... View more
10-28-2024
10:16 AM
|
1
|
2
|
692
|
POST
|
The way you do this is at the Feature Service level. In the API, it is done via a FeatureLayerCollection object. So, you would update your example to something like this:
from arcgis.features import FeatureLayerCollection
items = user.items()
item = items[0]
flc = FeatureLayerCollection.fromitem(item)
flc.manager.update_definition({"cacheMaxAge":600})
This appears to round up to 15 minutes, however, because I think only certain intervals are supported.
... View more
09-23-2024
01:46 PM
|
1
|
0
|
723
|
POST
|
Use this to clear all tags:
item.update(item_properties={"tags":"", "clearEmptyFields": True})
... View more
09-23-2024
11:03 AM
|
1
|
3
|
947
|
POST
|
It seems like you are on an older version of the API which does not have that feature. Try updating per documentation: Install and Setup | ArcGIS API for Python
... View more
09-12-2024
12:46 PM
|
0
|
1
|
1077
|
POST
|
I'm not sure, unfortunately. I may be wrong, but it looks like nothing was logged for this behavior when this thread was last active: https://github.com/Esri/arcgis-python-api/issues
... View more
09-10-2024
05:06 PM
|
0
|
0
|
1943
|
POST
|
I would recommend you log an issue here: Issues · Esri/arcgis-python-api · GitHub Myself, I've never encountered this problem in the wild and don't know why it's slow to populate/missing for some people. I do know that the _hydrate method is involved in the population of that property and yes, calling this method should involve an additional call to get item information. It's possible the logic in the _hydrate method needs to be adjusted for the size property to be properly set in all items, or perhaps the REST endpoint is not reliably returning the size information for certain items. It looks like the supporting get_item_data method points to this endpoint: /data: Item Data | ArcGIS REST APIs | ArcGIS Developers Do you get similar results when making a request to that endpoint? If you don't, then that at least narrows down the problem to the code.
... View more
09-10-2024
06:42 AM
|
0
|
0
|
1367
|
POST
|
A similar question was asked a while back: Solved: Populating dataframe with item search results - va... - Esri Community Vars did not work well for them either (also took a long time). I can't say what the problem might be, but a list comprehension seemed to do the trick for them. [{"id": item.id, "size": item.size, "type": item.type} for item in items]
... View more
09-09-2024
02:10 PM
|
0
|
0
|
1443
|
POST
|
Seems like an access issue as you appear to be pointing to a file inside a zip. Try unarchiving and see if it works that way.
... View more
08-20-2024
09:28 AM
|
0
|
0
|
723
|
POST
|
In the past, I regularly did same-portal clones to make backups of services for testing. I've just tested it again now on version 2.3.1 of the API and had no problems. Is it possible the problem is isolated to certain items? Are you cloning a hosted feature layer? Also, does it make any difference if you explicitly log into the GIS instead of using "home" ?
... View more
08-08-2024
10:14 AM
|
0
|
2
|
2059
|
POST
|
You should be able to do something like this in the python command prompt installed with the software (with your environment active): conda install <pkg>=<version>
... View more
08-07-2024
06:09 AM
|
0
|
0
|
2115
|
Title | Kudos | Posted |
---|---|---|
1 | 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 |