--- title: Importing Data keywords: fastai sidebar: home_sidebar summary: "In this tutorial, the basics of Importing data with Colabs are introduced and data is loaded with Pandas and Geopandas." description: "In this tutorial, the basics of Importing data with Colabs are introduced and data is loaded with Pandas and Geopandas." nb_path: "notebooks/01_Download_and_Load.ipynb" ---
⚠️ This writing is a work in progress. The functions work. ⚠️
Please read everything found on the mainpage before continuing; disclaimer and all.
Instructions: Read all text and execute all code in order.
How XYZ :
If you would like to ...
For this next example to work, we will need to import hypothetical csv files
Try It! Go ahead and try running the cell below.
# Otherwise this tool assumes shp or pgeojson files have geom='geometry', in_crs=2248.
# Depending on interactivity the values should be
# coerce fillna(-1321321321321325)
# Returns
u = Intake
rdf = Intake.getData('https://services1.arcgis.com/mVFRs7NF4iFitgbY/ArcGIS/rest/services/Hhchpov/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&f=pgeojson')
rdf.head(1)
Here we can save the data so that it may be used in later tutorials.
rdf
# .to_csv(string+'.csv', encoding="utf-8", index=False, quoting=csv.QUOTE_ALL)
Download data by:
You can upload this data into the next tutorial in one of two ways.
1)
OR.
2)
Here are some examples:
Using Esri and the Geoms handler directly:
import dataplay
geoloom_gdf_url = "https://services1.arcgis.com/mVFRs7NF4iFitgbY/ArcGIS/rest/services/Geoloom_Crowd/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&f=pgeojson"
geoloom_gdf = dataplay.geoms.readInGeometryData(url=geoloom_gdf_url, porg=False, geom='geometry', lat=False, lng=False, revgeocode=False, save=False, in_crs=4326, out_crs=False)
geoloom_gdf = geoloom_gdf.dropna(subset=['geometry'])
geoloom_gdf.head(1)
Again but with the Intake class:
u = Intake
Geoloom_Crowd, rcol = u.getAndCheck('https://services1.arcgis.com/mVFRs7NF4iFitgbY/ArcGIS/rest/services/Geoloom_Crowd/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&f=pgeojson')
Geoloom_Crowd.head(1)
This getAndCheck function is usefull for checking for a required field.
Hhpov, rcol = u.getAndCheck('https://services1.arcgis.com/mVFRs7NF4iFitgbY/ArcGIS/rest/services/Hhpov/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&f=pgeojson', 'hhpov19', True)
Hhpov = Hhpov[['CSA2010', 'hhpov15', 'hhpov16', 'hhpov17', 'hhpov18', 'hhpov19']]
# Hhpov.to_csv('Hhpov.csv')
Hhpov.head()
We could also retrieve from a file.
u = Intake
# rdf = u.getData('Hhpov.csv')
rdf.head()