mirror of
				https://github.com/zyphlar/sonoma-import.git
				synced 2024-03-08 15:07:48 +00:00 
			
		
		
		
	Update conflate
This commit is contained in:
		
							parent
							
								
									6f28b42e09
								
							
						
					
					
						commit
						fa89fe98f6
					
				@ -31,7 +31,7 @@ Here are sample screenshots of Sonoma County, Santa Rosa, the City of Sonoma, an
 | 
			
		||||
- https://gis-sonomacounty.hub.arcgis.com/datasets/2202c1cd6708441f987ca5552f2d9659
 | 
			
		||||
- https://gis-sonomacounty.hub.arcgis.com/datasets/0f5982c3582d4de0b811e68d7f0bff8f
 | 
			
		||||
- http://download.geofabrik.de/north-america/us/california/norcal-latest.osm.pbf
 | 
			
		||||
- VTATaz: https://drive.google.com/file/d/0B098fXDVjQOhVHBFS0kwcDNGRlU/view
 | 
			
		||||
- VTATaz (included in git, original_data): https://drive.google.com/file/d/0B098fXDVjQOhVHBFS0kwcDNGRlU/view
 | 
			
		||||
 | 
			
		||||
Script:
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -4,15 +4,15 @@
 | 
			
		||||
 | 
			
		||||
-- add fields for OSM tags and data processing 
 | 
			
		||||
ALTER TABLE sonoma_county_building_outlines
 | 
			
		||||
	ADD COLUMN "addr:housenumber" text,
 | 
			
		||||
	ADD COLUMN "addr:street" text,
 | 
			
		||||
	ADD COLUMN "addr:unit" text,
 | 
			
		||||
	ADD COLUMN "addr:city" text,
 | 
			
		||||
	ADD COLUMN "addr:state" text,
 | 
			
		||||
	ADD COLUMN usecode integer,
 | 
			
		||||
	ADD COLUMN loc_geom geometry(multipolygon,4326),
 | 
			
		||||
	ADD COLUMN conflated boolean DEFAULT FALSE,
 | 
			
		||||
	ADD COLUMN main boolean; -- is it the main building on the parcel?
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:housenumber" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:street" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:unit" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:city" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:state" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS usecode integer,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS loc_geom geometry(multipolygon,4326),
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS conflated boolean DEFAULT FALSE,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS main boolean; -- is it the main building on the parcel?
 | 
			
		||||
 | 
			
		||||
update sonoma_county_building_outlines set "addr:housenumber" = NULL, "addr:street" = NULL, "addr:unit" = NULL, "addr:city" = NULL, "addr:state" = NULL;
 | 
			
		||||
 | 
			
		||||
@ -22,14 +22,14 @@ update sonoma_county_building_outlines set "addr:housenumber" = NULL, "addr:stre
 | 
			
		||||
 | 
			
		||||
-- added fields for the parcels table
 | 
			
		||||
ALTER TABLE parcels__public_
 | 
			
		||||
    ADD COLUMN "addr:housenumber" text,
 | 
			
		||||
	ADD COLUMN "addr:street" text,
 | 
			
		||||
	ADD COLUMN "addr:unit" text,
 | 
			
		||||
	ADD COLUMN "addr:city" text,
 | 
			
		||||
	ADD COLUMN "addr:state" text,
 | 
			
		||||
	ADD COLUMN loc_geom geometry(multipolygon,4326),
 | 
			
		||||
	ADD COLUMN building_count integer,
 | 
			
		||||
	ADD COLUMN repeating BOOLEAN DEFAULT FALSE;
 | 
			
		||||
    ADD COLUMN IF NOT EXISTS "addr:housenumber" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:street" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:unit" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:city" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS "addr:state" text,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS loc_geom geometry(multipolygon,4326),
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS building_count integer,
 | 
			
		||||
	ADD COLUMN IF NOT EXISTS repeating BOOLEAN DEFAULT FALSE;
 | 
			
		||||
 | 
			
		||||
update parcels__public_ set "addr:housenumber" = NULL, "addr:street" = NULL, "addr:unit" = NULL, "addr:city" = NULL, "addr:state" = NULL;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								trial.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								trial.sh
									
									
									
									
									
								
							@ -19,7 +19,7 @@ psql --echo-all --command="create extension if not exists postgis;" "${DBNAME}"
 | 
			
		||||
psql --echo-all --file="103240.sql" "${DBNAME}" -h $PGHOST -U $PGUSER
 | 
			
		||||
 | 
			
		||||
echo "Importing TAZ"
 | 
			
		||||
shp2pgsql -d -D -s 103240 -I "data/VTATaz" | psql -d "${DBNAME}" -h $PGHOST -U $PGUSER >/dev/null
 | 
			
		||||
shp2pgsql -d -D -s 103240 -I "original_data/VTATaz/VTATaz" | psql -d "${DBNAME}" -h $PGHOST -U $PGUSER >/dev/null
 | 
			
		||||
 | 
			
		||||
# Conflate addresses to buildings
 | 
			
		||||
psql -v "ON_ERROR_STOP=true" --echo-queries --file="conflation.sql" "${DBNAME}" -h $PGHOST -U $PGUSER
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user