mirror of
				https://github.com/zyphlar/sonoma-import.git
				synced 2024-03-08 15:07:48 +00:00 
			
		
		
		
	Remove all building addresses with SR city limits
This commit is contained in:
		
							parent
							
								
									a4b1091d63
								
							
						
					
					
						commit
						8bcc94e49d
					
				
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							@ -72,11 +72,19 @@ Debian (shp2pgsql is included in postgis)
 | 
				
			|||||||
## Running
 | 
					## Running
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- We are assuming that the county data uses a WGS84 aka EPSG:4326 geographical projection, which was true as of last check and is also what OSM uses.
 | 
					- We are assuming that the county data uses a WGS84 aka EPSG:4326 geographical projection, which was true as of last check and is also what OSM uses.
 | 
				
			||||||
- Run from your shell: `shp2pgsql -s 4326 -I Parcels__Public_.shp | psql -d openstreetmap -U openstreetmap -W`
 | 
					- Run from your shell:
 | 
				
			||||||
- `shp2pgsql -s 4326 -I Sonoma_County_Building_Outlines.shp | psql -d openstreetmap -U openstreetmap -W`
 | 
					 | 
				
			||||||
- `osm2pgsql -d openstreetmap -c --prefix son --slim --extra-attributes --hstore --latlong norcal-latest.osm.pbf -U openstreetmap -W -H localhost -P 5432`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
osm2pgsql should create tables like `son_polygon` for later.
 | 
					```
 | 
				
			||||||
 | 
					cd original_data
 | 
				
			||||||
 | 
					shp2pgsql -s 4326 -I Parcels__Public_.shp | psql -d openstreetmap -U openstreetmap -W
 | 
				
			||||||
 | 
					shp2pgsql -s 4326 -I Sonoma_County_Building_Outlines.shp | psql -d openstreetmap -U openstreetmap -W
 | 
				
			||||||
 | 
					osm2pgsql -d openstreetmap -c --prefix son --slim --extra-attributes --hstore --latlong norcal-latest.osm.pbf -U openstreetmap -W -H localhost -P 5432
 | 
				
			||||||
 | 
					ogr2ogr -f "PostgreSQL" PG:"host=localhost dbname=openstreetmap user=openstreetmap port=5432 password=openstreetmap" "santa-rosa-boundary.geojson"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					shp2pgsql should create tables like `parcels__public_` and `sonoma_county_building_outlines`.
 | 
				
			||||||
 | 
					osm2pgsql should create tables like `son_polygon`.
 | 
				
			||||||
 | 
					ogr2ogr should create a table `santa_rosa_boundary`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Now all the data is in Postgres. For processing and conflation, read through and execute `conflation.sql` as per your comfort level.
 | 
					Now all the data is in Postgres. For processing and conflation, read through and execute `conflation.sql` as per your comfort level.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -782,12 +782,26 @@ update sonoma_county_building_outlines as t
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Delete all address data in Santa Rosa, because the city's address data is better
 | 
					-- Delete all address data inside the Santa Rosa city limits, because the city's address data is better and already inserted as POIs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
update sonoma_county_building_outlines set "addr:housenumber" = NULL, "addr:unit" = NULL, "addr:street" = NULL, "addr:city" = NULL, "addr:state" = NULL where "addr:city" = 'Santa Rosa';
 | 
					update sonoma_county_building_outlines set
 | 
				
			||||||
 | 
						"addr:housenumber" = NULL,
 | 
				
			||||||
 | 
						"addr:unit" = NULL,
 | 
				
			||||||
 | 
						"addr:street" = NULL,
 | 
				
			||||||
 | 
						"addr:city" = NULL,
 | 
				
			||||||
 | 
						"addr:state" = NULL
 | 
				
			||||||
 | 
						from santa_rosa_boundary
 | 
				
			||||||
 | 
							where santa_rosa_boundary.admin_level = '8'
 | 
				
			||||||
 | 
							and ST_Intersects(wkb_geometry, sonoma_county_building_outlines.loc_geom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- More specifically drop TAZs that don't have any SJ data in them
 | 
					-- select * from sonoma_county_building_outlines join santa_rosa_boundary
 | 
				
			||||||
 | 
					-- 		on santa_rosa_boundary.admin_level = '8'
 | 
				
			||||||
 | 
					-- 		and ST_Intersects(wkb_geometry, sonoma_county_building_outlines.loc_geom)
 | 
				
			||||||
 | 
					-- 		limit 1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Drop TAZs that don't have any SC data in them
 | 
				
			||||||
-- delete from VTATaz
 | 
					-- delete from VTATaz
 | 
				
			||||||
-- 	where key not in (
 | 
					-- 	where key not in (
 | 
				
			||||||
-- 		select distinct cid from sonoma_county_building_outlines
 | 
					-- 		select distinct cid from sonoma_county_building_outlines
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15886
									
								
								original_data/santa-rosa-boundary.geojson
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15886
									
								
								original_data/santa-rosa-boundary.geojson
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user