POST
|
There's a bug in import_data that creates a service by the name 'a' the first time it runs... the fix will be in the next update, but as a workaround you should be able to search for that service and delete it each time you're calling import_data with a spatial dataframe.
... View more
08-29-2017
11:26 AM
|
2
|
0
|
3553
|
POST
|
If there are more than 1000 rows, you should convert it to a SpatialDataFrame. You can do it like this: df['SHAPE'] = df.apply(lambda row : arcgis.geometry.Geometry({'x': row['x'], 'y': row['y']}), axis=1 ) sdf = SpatialDataFrame(df) layer = gis.content.import_data(sdf, title='My Data') m.add_layer(layer) # add to map find_nearest(layer, ...) # use for analysis
... View more
08-29-2017
09:51 AM
|
2
|
2
|
3553
|
POST
|
The Python API currently doesn't support proxies. We will be adding this support to the next release (release data TBD). Till then, can you see if you can use the workaround at The lazy Flimbot: Using ArcGIS API for Python (1.0.1) behind a proxy ?
... View more
08-24-2017
08:54 AM
|
1
|
14
|
5375
|
POST
|
Do the features in the FeatureSet have a time field? What does a feature in the FeatureSet look like (json)? Reconstruct tracks uses the time to reconstruct the tracks. Another way to create FeatureSets from a set of GPS coordinates will be to use gis.content.import_data as in the Watson integration example at arcgis-python-api/ArcGIS Python API for Analysts and Data Scientists.ipynb at master · Esri/arcgis-python-api · GitHub
... View more
08-11-2017
09:59 AM
|
0
|
0
|
368
|
POST
|
Jens, The input features to reconstruct_tracks allows Feature Collection to be passed in as a Python dictionary. You should be able to get the dict from a FeatureSet using it's value property and construct a FeatureCollection from it and pass it in the reconstruct_tracks tool. Rohit
... View more
08-10-2017
11:45 AM
|
0
|
2
|
368
|
POST
|
The API is a standard Python API and would work with Zeppelin. The map widget would not work with Zeppelin though as it's a Jupyter Notebook widget.
... View more
08-04-2017
09:31 AM
|
1
|
0
|
395
|
POST
|
If you mean enable popups on the map widget - yes. See the sections on popups in the notebook at arcgis-python-api/Mapping, Visualization, and Analysis Using ArcGIS API for Python.ipynb at master · Esri/arcgis-python-…
... View more
08-04-2017
09:22 AM
|
1
|
2
|
539
|
POST
|
Server does not contain the ArcGIS API for Python library and that would explain why it's failing.
... View more
07-27-2017
06:03 PM
|
1
|
0
|
670
|
POST
|
The layer/FeatureCollection to be added should have a correct spatial reference set in that case. I don't have the code offhand to do this though. Another way would be to use arcgis.geometry.project to project the coordinates to WGS1984.
... View more
07-27-2017
10:50 AM
|
0
|
0
|
662
|
POST
|
Try setting the columns of your dataframe to x and y. The following works: from arcgis.gis import *
import pandas as pd
gis = GIS()
m = gis.map('UK')
locations = [(52.47867, -1.90848),
(51.50642, -0.12721),
(53.79480, -1.54653),
(53.47959, -2.24874)]
df = pd.DataFrame.from_records(locations)
df.columns = ['y', 'x']
cities = gis.content.import_data(df)
m.add_layer(cities)
m
I get the following output:
... View more
07-26-2017
10:28 PM
|
2
|
6
|
3553
|
POST
|
Yes, an example is below: locations = []
path = r'C:\xc\Presentations\GeoPython\Watson\insulators'
# find locations of broken insulators
for file in listdir(path):
filepath = path + '\\' + file
if is_broken(filepath):
locations.append(get_location(filepath))
# import into ArcGIS as a layer
df = pd.DataFrame.from_records(locations)
df.columns = ['x', 'y']
broken_insulators = gis.content.import_data(df)
m.add_layer(broken_insulators) I have defined get_locations to return longitude, latitude: def get_location(filename): #... return lon, lat
... View more
07-25-2017
07:29 AM
|
1
|
9
|
3553
|
POST
|
You can do both - i.e. draw graphics on map widget, or create a feature collection from the points and add that to the map widget. Examples of both techniques are shown below: 1) Draw points on a map widget: sms = {"color": [255,255,0,255], "size": 5, "type": "esriSMS", "style": "esriSMSCircle"}
for lat,lon,title,content in get_coordinates():
m.draw({'x':lon,'y':lat}, symbol=sms, popup={'title':title,'content':content})
2) Create a FeatureCollection from the points and draw them:
locations = []
path = r'C:\xc\Presentations\GeoPython\Watson\insulators'
# find locations of broken insulators
for file in listdir(path):
filepath = path + '\\' + file
if is_broken(filepath):
locations.append(get_location(filepath))
# import into ArcGIS as a layer
df = pd.DataFrame.from_records(locations)
df.columns = ['x', 'y']
broken_insulators = gis.content.import_data(df)
m.add_layer(broken_insulators) I like approach 2 as then you can use the FeatureCollection for other purposes such as calling spatial analysis tools: # get layer of transmission towers
towers = gis.content.search('BPA_TransmissionStructures', 'Feature Layer', outside_org=True)[0]
# find transmission towers near image locations
destinations = join_features(towers, broken_insulators, "withindistance", 0.1, "Miles")
... View more
07-25-2017
07:26 AM
|
1
|
2
|
1399
|
POST
|
Another example / workflow is shared in Kevin's blog post at https://blogs.esri.com/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/
... View more
07-24-2017
10:30 AM
|
3
|
1
|
1981
|
POST
|
You don't have to export your data to a csv. You can overwrite feature layers using arcgis.features.managers module — arcgis 1.2.0 documentation You can also read in a file geodatabase or shapefile as a Spatial Data Frame and get it in pandas before pushing the updates to a feature layer, on similar patterns as the examples shared above.
... View more
07-24-2017
10:28 AM
|
2
|
3
|
5819
|
Title | Kudos | Posted |
---|---|---|
1 | 07-05-2018 06:35 AM | |
1 | 03-14-2018 08:13 PM | |
2 | 08-29-2017 09:51 AM | |
1 | 12-23-2016 04:05 AM | |
1 | 01-06-2017 11:24 AM |
Online Status |
Offline
|
Date Last Visited |
02-16-2024
03:28 AM
|