Changes between Version 235 and Version 236 of UserGuidelines/GIS/Data


Ignore:
Timestamp:
06/04/14 14:02:30 (8 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuidelines/GIS/Data

    v235 v236  
    347347Global Rural-Urban Mapping Project, version 1 (GRUMPv1) is a newer dataset which combines satellite with census data to locate people within settlements rather than just administrative areas:
    348348 * http://sedac.ciesin.columbia.edu/gpw/aboutus.jsp
     349
     350==== US Census ====
     351For the US, data is available down to block level:
     352
     353http://factfinder2.census.gov/faces/nav/jsf/pages/download_center.xhtml
     354Dicennial Census
     3552010 SF1 100% Data
     356
     357Convert data from NAD83 to WGS84 (e.g. using qGIS)
     358
     359{{{
     360su postgres
     361cd /data/Census2010BlockGroup
     362shp2pgsql -s 4326 -I tl_2010_06037_bg10_WGS84.shp public.Census2010BlockGroup | psql -d gis
     363psql
     364\c gis
     365ALTER TABLE census2010blockgroup ADD COLUMN population integer;
     366ALTER TABLE census2010blockgroup ADD COLUMN population_density integer;
     367\q
     368exit
     369
     370w2p
     371%autoindent
     372pop_dict = {}
     373input = os.path.join("/", "home", "data", "Census2010BlockGroup", "DEC_10_SF1_P1_with_ann.csv")
     374inputFile = open(input, "r")
     375header = 2
     376for line in inputFile:
     377    if header:
     378        header -= 1
     379        continue
     380    parts = line.split(',', 6)
     381    geoid = parts[1]
     382    pop = int(parts[6].strip())
     383    pop_dict[geoid] = pop
     384
     385inputFile.close()
     386from __future__ import division
     387db_string = "postgres://gis:GIS@localhost:5432/gis"
     388db2 = DAL(db_string, migrate_enabled = False)
     389table = db2.define_table("census2010blockgroup", Field("gid", "id"), Field("geoid10"), Field("aland10", "integer"), Field("population", "integer"), Field("population_density", "integer"), migrate=False)
     390rows = db2().select(table.geoid10, table.aland10)
     391for row in rows:
     392    data = {}
     393    geoid10 = row.geoid10
     394    population = pop_dict.get(geoid10)
     395    if population:
     396        data["population"] = population
     397        aland10 = row.aland10
     398        if aland10:
     399            area = aland10 / 2589988
     400            population_density = population / area
     401            data["population_density"] = population_density
     402        db2(table.geoid10==geoid10).update(**data)
     403
     404db2.commit()
     405}}}
     406
     407Can also have the Tract-level data for lower zoom (9-15) & create a Layer Group to serve the 2 layers with a style which shows only 1 level at each zoom
    349408=== Topographic Maps ===
    350409==== WMS ====