Select to view content in your preferred language

New to ArcGIS Pro Notebooks

1268
2
Jump to solution
02-03-2022 03:23 AM
MVAC
by
Occasional Contributor

Hello,

I'm having some issues finding my way around the notebooks on pro. I created a geodataframe to then create a point feature class and add it to my gdb. But I cant find the way to create the point feature (and visualize it on a map on pro) and add it to my geodatabase.

 

# imports
from shapely.geometry import Point
import pandas as pd
import geopandas as gpd

# stations coordinates
data = {'STATION': ['Attard', 'Gharb', 'Msida', 'Zejtun', 'St_Pauls_bay', 'Senglea'],
        'X': [14.45, 14.20, 14.49, 14.54, 14.41, 14.51],
        'Y': [35.89, 36.07, 35.99, 35.88, 35.95, 35.88]}

# turn the data into a Pandas DataFrame, column names are extracted automatically
df = pd.DataFrame(data)
print(df.head)

# use the coordinates to make shapely Point geometries
geometry = [Point(xy) for xy in zip(df['X'], df['Y'])]

# pandas DataFrame and shapely Points can together become a GeoPandas GeoDataFrame
maltaGDF = gpd.GeoDataFrame(df, geometry=geometry, crs = "EPSG:4326")
print(maltaGDF)

 

Thanks

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

The ArcGIS Python API has its own "flavor" of spatial dataframe, the GeoAccessor. If you're working within an ArcGIS environment, you're much better off using it as opposed to GeoPandas. A GeoAccessor can export directly to a geodatabase for use in a map.

For the visualization portion, however, you'll need to make use of arcpy. The ArcGIS Python API is great for lots of things, but not for interfacing with Pro. Specifically, you should look at arcpy.mp for working with maps.

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

The ArcGIS Python API has its own "flavor" of spatial dataframe, the GeoAccessor. If you're working within an ArcGIS environment, you're much better off using it as opposed to GeoPandas. A GeoAccessor can export directly to a geodatabase for use in a map.

For the visualization portion, however, you'll need to make use of arcpy. The ArcGIS Python API is great for lots of things, but not for interfacing with Pro. Specifically, you should look at arcpy.mp for working with maps.

- Josh Carlson
Kendall County GIS
MVAC
by
Occasional Contributor

Thanks!

0 Kudos