Database Reference
In-Depth Information
The
proportional_sum
functionwilltakeintoaccountourinputgeometryandthe
count
valueofthepopulationandreturnanestimateoftheproportionalpopulation.
Now,weneedtoloadourcensusdataandzoolocation.Usethefollowingcommand:
shp2pgsql -s 3734 -d -i -I -W LATIN1 -g
the_geom census chp06.census | psql -U me -d
postgis_cookbook -h localhost
Also, if you have not yet loaded the data mentioned in the
Loading data from
OpenStreetMap and finding the shortest path using A*
recipe,takethetimetodoso
now.
Once all of the data is entered, we can proceed with the analysis.
How to do it...
The
pgr_drivingdistance
polygonwecreatedisthefirststepinthedemograph-
icanalysis.Refertothe
Driving distance/service area calculation
recipeifyouneed
to familiarize yourself with its use. In this case, we'll consider bicycling distance.
ClevelandMetroparksZooisnearestthenode,164495;sowe'llusethatasthecen-
ter point for our
pgr_drivingdistance
calculation, and 6.437376 kilometers as
our distance, as we want to know the number of zoo visitors within 4 miles of the
Cleveland Metroparks Zoo:
CREATE TABLE zoo_bikezone AS (
WITH alphashape AS (
SELECT pgr_alphaShape('
WITH DD AS (
SELECT seq, id1 AS node, cost
FROM pgr_drivingDistance(
''SELECT gid AS id, source, target,
reverse_cost AS cost FROM cleveland_ways'',
165232, 6.437376, false, false
)
),
dd_points AS(