Skip to content

Instantly share code, notes, and snippets.

@fscottfoti
Created December 2, 2014 23:00
Show Gist options
  • Save fscottfoti/63301e4985f5cf78a7ea to your computer and use it in GitHub Desktop.
Save fscottfoti/63301e4985f5cf78a7ea to your computer and use it in GitHub Desktop.
data loader
{
"metadata": {
"name": "",
"signature": "sha256:1cb19ce6c787115025feeb23df2dc82b4547224d32a0d8f2dfc941418962d417"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from urbancanvas_dataloader.urbancanvas import UrbanCanvas\n",
"import geopandas as gpd"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# set build schema to True if you haven't created the db yet\n",
"uc = UrbanCanvas(\"bayarea\", 3857, build_schema=True)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# use this as my parcel file\n",
"gdf = gpd.GeoDataFrame.from_file(\"data/16th_st_feasibility_analysis.geojson\")\n",
"# remove all the columns but geometry since they don't the schema\n",
"gdf = gdf[[\"geometry\"]]"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# by default does not append\n",
"uc.load_parcel_data(parcels=gdf)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment