Merge pull request #39 from CartoDB/add-boundary-bbox-functions

Adding boundary overlap functions
This commit is contained in:
john krauss
2016-05-03 17:16:00 -04:00
8 changed files with 2345 additions and 58 deletions

View File

@@ -84,7 +84,7 @@ Should add the SQL API call here too
## OBS_GetUSCensusCategory(point_geometry, measure_name);
The ```OBS_GetUSCensusCategory(point_geometry, category_name)``` method returns a categorical measure based on a subset of the US Census variables at a point location. It requires a different function from ```OBS_GetUSCensusMeasure``` because this function will always return TEXT, whereas ```OBS_GetUSCensusMeasure``` will always returna NUMERIC value.
The ```OBS_GetUSCensusCategory(point_geometry, category_name)``` method returns a categorical measure based on a subset of the US Census variables at a point location. It requires a different function from ```OBS_GetUSCensusMeasure``` because this function will always return TEXT, whereas ```OBS_GetUSCensusMeasure``` will always returna NUMERIC value.
#### Arguments
@@ -202,16 +202,17 @@ Should add the SQL API call here too
# Boundaries
## OBS_GetGeometry(point_geometry, boundary_id)
## OBS_GetBoundary(point_geometry, boundary_id)
The ```OBS_GetGeometry(point_geometry, boundary_id)``` method returns a boundary geometry defined as overlapping the point geometry and from the desired boundary set (e.g. Census Tracts). See the [Boundary ID glossary table below](below). This is a useful method for performing aggregations of points.
The ```OBS_GetBoundary(point_geometry, boundary_id)``` method returns a boundary geometry defined as overlapping the point geometry and from the desired boundary set (e.g. Census Tracts). See the [Boundary ID glossary table below](below). This is a useful method for performing aggregations of points.
#### Arguments
Name | Description
--- | ---
point_geometry | a WGS84 polygon geometry (the_geom)
boundary_id | a boundary identifier from the [Boundary ID glossary table below](below)
boundary_id | a boundary identifier from the [Boundary ID glossary table below](below)
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
#### Returns
@@ -224,23 +225,25 @@ geom | WKB geometry
Overwrite a point geometry with a boundary geometry that contains it in your table
```SQL
UPDATE tablename SET the_geom = OBS_GetGeometry(the_geom, ' "us.census.tiger".block_group')
UPDATE tablename
SET the_geom = OBS_GetBoundary(the_geom, '"us.census.tiger".block_group')
```
<!--
Should add the SQL API call here too
-->
## OBS_GetGeometryId(point_geometry, boundary_id)
## OBS_GetBoundaryId(point_geometry, boundary_id)
The ```OBS_GetGeometryId(point_geometry, boundary_id)``` returns a unique geometry_id for the boundary geometry that contains a given point geometry. See the [Boundary ID glossary table below](below). The method can be combined with ```OBS_GetGeometryById(geometry_id)``` to create a point aggregation workflow.
The ```OBS_GetBoundaryId(point_geometry, boundary_id)``` returns a unique geometry_id for the boundary geometry that contains a given point geometry. See the [Boundary ID glossary table below](below). The method can be combined with ```OBS_GetBoundaryById(geometry_id)``` to create a point aggregation workflow.
#### Arguments
Name |Description
--- | ---
point_geometry | a WGS84 polygon geometry (the_geom)
boundary_id | a boundary identifier from the [Boundary ID glossary table below](below)
point_geometry | a WGS84 point geometry (the_geom)
boundary_id | a boundary identifier from the [Boundary ID glossary table below](below)
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
#### Returns
@@ -253,18 +256,21 @@ geometry_id | a string identifier of a geometry in the Boundaries
Write the geometry_id that contains the point geometry for every row as a new column in your table
```SQL
UPDATE tablename SET new_column_name = OBS_GetGeometryId(the_geom, ' "us.census.tiger".block_group')
UPDATE tablename
SET new_column_name = OBS_GetBoundaryId(the_geom, ' "us.census.tiger".block_group')
```
## OBS_GetGeometryById(geometry_id)
## OBS_GetBoundaryById(geometry_id, boundary_id)
The ```OBS_GetGeometryById(geometry_id)``` returns the boundary geometry for a unique geometry_id. A geometry_id can be found using the ```OBS_GetGeometryId(point_geometry, boundary_id)``` method described above.
The ```OBS_GetBoundaryById(geometry_id, boundary_id)``` returns the boundary geometry for a unique geometry_id. A geometry_id can be found using the ```OBS_GetBoundaryId(point_geometry, boundary_id)``` method described above.
#### Arguments
Name |Description
Name | Description
--- | ---
geometry_id | a string identifier for a Boundary geometry
boundary_id | a boundary identifier from the [Boundary ID glossary table below](below)
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
#### Returns
@@ -276,10 +282,186 @@ geom | a WGS84 polygon geometry
#### Example
Use a table of geometry_id to select the unique boundaries. Useful with the ```Table from query``` option in CartoDB.
Use a table of geometry_id to select the unique boundaries. Useful with the ```Create Dataset from Query``` option in CartoDB.
```SQL
SELECT OBS_GetGeometryById(geometry_id) the_geom, geometry_id FROM tablename GROUP BY geometry_id
SELECT OBS_GetBoundaryById(geometry_id) As the_geom, geometry_id
FROM tablename
GROUP BY geometry_id
```
## OBS_GetBoundariesByGeometry(geometry, geometry_id)
The ```OBS_GetBoundariesByGeometry(geometry, geometry_id)``` method returns the boundary geometries and their geographical identifiers that intersect (or are contained by) a bounding box polygon.
#### Arguments
Name |Description
--- | ---
geometry | a bounding box
geometry_id | a string identifier for a boundary geometry
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
overlap_type (optional) | one of 'intersects' (default), 'contains', or 'within'. See [ST_Intersects](http://postgis.net/docs/manual-2.2/ST_Intersects.html), [ST_Contains](http://postgis.net/docs/manual-2.2/ST_Contains.html), or [ST_Within](http://postgis.net/docs/manual-2.2/ST_Within.html) for more
#### Returns
A table with the following columns:
Column Name | Description
--- | ---
the_geom | a boundary geometry (e.g., US Census tracts)
geom_ref | a string identifier for the geometry (e.g., the geoid of a US Census tract)
#### Example
Get all Census Tracts in Lower Manhattan (geoids beginning with `36061`) without getting Brooklyn or New Jersey
```sql
SELECT *
FROM OBS_GetBoundariesByGeometry(
ST_MakeEnvelope(-74.0251922607,40.6945658517,
-73.9651107788,40.7377626342,
4326),
'"us.census.tiger".census_tract')
WHERE geom_ref like '36061%'
```
#### API Example
Retrieve all Census tracts contained in a bounding box around Denver, CO as a JSON response:
```text
http://observatory.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20OBS_GetBoundariesByGeometry(ST_MakeEnvelope(-105.4287704158,39.4600507935,-104.5089737248,40.0901569675,4326),%27%22us.census.tiger%22.census_tract%27,%272009%27,%27contains%27)
```
## OBS_GetPointsByGeometry(geometry, geometry_id)
The ```OBS_GetPointsByGeometry(geometry, geometry_id)``` method returns point geometries and their geographical identifiers that intersect (or are contained by) a bounding box polygon and lie on the surface of a boundary corresponding to the boundary with same geographical identifiers (e.g., a point that is on a census tract with the same geoid).
#### Arguments
Name |Description
--- | ---
geometry | a bounding box
geometry_id | a string identifier for a boundary geometry
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
overlap_type (optional) | one of 'intersects' (default), 'contains', or 'within'. See [ST_Intersects](http://postgis.net/docs/manual-2.2/ST_Intersects.html), [ST_Contains](http://postgis.net/docs/manual-2.2/ST_Contains.html), or [ST_Within](http://postgis.net/docs/manual-2.2/ST_Within.html) for more
#### Returns
A table with the following columns:
Column Name | Description
--- | ---
the_geom | a point geometry on a boundary (e.g., a point that lies on a US Census tract)
geom_ref | a string identifier for the geometry (e.g., the geoid of a US Census tract)
#### Example
Get points in all Census Tracts in Lower Manhattan (geoids beginning with `36061`) without getting Brooklyn or New Jersey
```sql
SELECT *
FROM OBS_GetPointsByGeometry(
ST_MakeEnvelope(-74.0251922607,40.6945658517,
-73.9651107788,40.7377626342,
4326),
'"us.census.tiger".census_tract')
WHERE geom_ref like '36061%'
```
#### API Example
Retrieve all Census tracts contained in a bounding box around Denver, CO as a JSON response:
```text
http://observatory.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20OBS_GetPointsByGeometry(ST_MakeEnvelope(-105.4287704158,39.4600507935,-104.5089737248,40.0901569675,4326),%27%22us.census.tiger%22.census_tract%27,%272009%27,%27contains%27)
```
## OBS_GetBoundariesByPointAndRadius(geometry, radius, boundary_id)
The ```OBS_GetBoundariesByPointAndRadius(geometry, radius, boundary_id)``` method returns boundary geometries and their geographical identifiers that intersect (or are contained by) a circle centered on a point with a radius.
#### Arguments
Name |Description
--- | ---
geometry | a point geometry
radius | a radius (in meters) from the center point
geometry_id | a string identifier for a boundary geometry
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
overlap_type (optional) | one of 'intersects' (default), 'contains', or 'within'. See [ST_Intersects](http://postgis.net/docs/manual-2.2/ST_Intersects.html), [ST_Contains](http://postgis.net/docs/manual-2.2/ST_Contains.html), or [ST_Within](http://postgis.net/docs/manual-2.2/ST_Within.html) for more
#### Returns
A table with the following columns:
Column Name | Description
--- | ---
the_geom | a boundary geometry (e.g., a US Census tract)
geom_ref | a string identifier for the geometry (e.g., the geoid of a US Census tract)
#### Example
Get Census tracts which intersect within 10 miles of Downtown, Colorado.
```sql
SELECT *
FROM OBS_GetBoundariesByPointAndRadius(
CDB_LatLng(39.7392, -104.9903), -- Denver, Colorado
10000 * 1.609, -- 10 miles (10km * conversion to miles)
'"us.census.tiger".census_tract')
```
#### API Example
Retrieve all Census tracts contained in a bounding box around Denver, CO as a JSON response:
```text
http://observatory.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20OBS_GetBoundariesByPointAndRadius(CDB_LatLng(39.7392,-104.9903),10000*1609),%27%22us.census.tiger%22.census_tract%27,%272009%27,%27contains%27)
```
## OBS_GetPointsByPointAndRadius(geometry, radius, boundary_id)
The ```OBS_GetPointsByPointAndRadius(geometry, radius, boundary_id)``` method returns point geometries on boundaries (e.g., a point that lies on a Census tract) and their geographical identifiers that intersect (or are contained by) a circle centered on a point with a radius.
#### Arguments
Name |Description
--- | ---
geometry | a point geometry
radius | radius (in meters)
geometry_id | a string identifier for a boundary geometry
timespan (optional) | year(s) to request from (`NULL` (default) gives most recent)
overlap_type (optional) | one of 'intersects' (default), 'contains', or 'within'. See [ST_Intersects](http://postgis.net/docs/manual-2.2/ST_Intersects.html), [ST_Contains](http://postgis.net/docs/manual-2.2/ST_Contains.html), or [ST_Within](http://postgis.net/docs/manual-2.2/ST_Within.html) for more
#### Returns
A table with the following columns:
Column Name | Description
--- | ---
the_geom | a point geometry (e.g., a point on a US Census tract)
geom_ref | a string identifier for the geometry (e.g., the geoid of a US Census tract)
#### Example
Get Census tracts which intersect within 10 miles of Downtown, Colorado.
```sql
SELECT *
FROM OBS_GetPointsByPointAndRadius(
CDB_LatLng(39.7392, -104.9903), -- Denver, Colorado
10000 * 1.609, -- 10 miles (10km * conversion to miles)
'"us.census.tiger".census_tract')
```
#### API Example
Retrieve all Census tracts contained in a bounding box around Denver, CO as a JSON response:
```text
http://observatory.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20OBS_GetPointsByPointAndRadius(CDB_LatLng(39.7392,-104.9903),10000*1609),%27%22us.census.tiger%22.census_tract%27,%272009%27,%27contains%27)
```
# Discovery
@@ -299,7 +481,7 @@ boundary_id | a string identifier for a Boundary geometry (optional)
Key | Description
--- | ---
measure_id | the unique id of the measue for use with the ```OBS_GetMeasure``` method
measure_id | the unique id of the measure for use with the ```OBS_GetMeasure``` method
name | the human readable name of the measure
description | a brief description of the measure
aggregate_type | **sum** are raw count values, **median** are statistical medians, **average** are statistical averages, **undefined** other (e.g. an index value)

View File

@@ -185,7 +185,7 @@ $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundaryById(
geometry_id text, -- ex: '36047'
boundary_id text, -- ex: '"us.census.tiger".county'
time_span text DEFAULT NULL --ex: '2009'
time_span text DEFAULT NULL -- ex: '2009'
)
RETURNS geometry(geometry, 4326)
AS $$
@@ -196,29 +196,8 @@ DECLARE
geom_colname text;
BEGIN
EXECUTE
format(
$string$
SELECT geoid_ct.colname As geoid_colname,
tablename,
geom_ct.colname As geom_colname
FROM observatory.obs_column_table As geoid_ct,
observatory.obs_table As geom_t,
observatory.obs_column_table As geom_ct,
observatory.obs_column As geom_c
WHERE geoid_ct.column_id
IN (
SELECT source_id
FROM observatory.obs_column_to_column
WHERE reltype = 'geom_ref'
AND target_id = '%s'
)
AND geoid_ct.table_id = geom_t.id and
geom_t.id = geom_ct.table_id and
geom_ct.column_id = geom_c.id and
geom_c.type ILIKE 'geometry'
$string$, boundary_id
) INTO geoid_colname, target_table, geom_colname;
SELECT * INTO geoid_colname, target_table, geom_colname
FROM cdb_observatory._OBS_GetGeometryMetadata(boundary_id);
RAISE NOTICE '%', target_table;
@@ -242,3 +221,332 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
-- _OBS_GetBoundariesByGeometry
-- internal function for retrieving geometries based on an input geometry
-- see OBS_GetBoundariesByGeometry or OBS_GetBoundariesByPointAndRadius for
-- more information
CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetBoundariesByGeometry(
geom geometry(Geometry, 4326),
boundary_id text,
time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects')
RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$
DECLARE
boundary geometry(Geometry, 4326);
geom_colname text;
geoid_colname text;
target_table text;
BEGIN
-- check inputs
IF lower(overlap_type) NOT IN ('contains', 'intersects', 'within')
THEN
-- recognized overlap type (map to ST_Contains, ST_Intersects, and ST_Within)
RAISE EXCEPTION 'Overlap type ''%'' is not an accepted type (choose intersects, within, or contains)', overlap_type;
ELSIF ST_GeometryType(geom) NOT IN ('ST_Polygon', 'ST_MultiPolygon')
THEN
RAISE EXCEPTION 'Invalid geometry type (%), expecting ''ST_MultiPolygon'' or ''ST_Polygon''', ST_GeometryType(geom);
END IF;
-- TODO: add timespan in search
-- TODO: add overlap info in search
SELECT * INTO geoid_colname, target_table, geom_colname
FROM cdb_observatory._OBS_GetGeometryMetadata(boundary_id);
-- if no tables are found, raise notice and return null
IF target_table IS NULL
THEN
RAISE NOTICE 'No boundaries found for bounding box ''%'' in ''%''', ST_AsText(geom), boundary_id;
RETURN QUERY SELECT NULL::geometry, NULL::text;
END IF;
RAISE NOTICE 'target_table: %', target_table;
-- return first boundary in intersections
RETURN QUERY
EXECUTE format(
'SELECT t.%s, t.%s
FROM observatory.%s As t
WHERE ST_%s($1, t.the_geom)
', geom_colname, geoid_colname, target_table, overlap_type)
USING geom;
END;
$$ LANGUAGE plpgsql;
-- OBS_GetBoundariesByGeometry
--
-- Given a bounding box (or a polygon), and it's geometry level (see
-- OBS_ListGeomColumns() for all available boundary ids), give back the
-- boundaries that are contained within the bounding box polygon and the
-- associated geometry ids
-- Inputs:
-- geom geometry: bounding box (or polygon) of the region of interest
-- boundary_id text: source id of boundaries (e.g., us.census.tiger.county)
-- see function OBS_ListGeomColumns for all avaiable
-- boundary ids
-- time_span text: time span that the geometries were collected (optional)
--
-- Output:
-- table with the following columns
-- boundary geometry: geometry boundary that is contained within the input
-- bounding box at the requested geometry level
-- with boundary_id, and time_span
-- geom_refs text: geometry identifiers (e.g., geoid for the US Census)
--
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByGeometry(
geom geometry(Geometry, 4326),
boundary_id text,
time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects')
RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$
BEGIN
RETURN QUERY SELECT *
FROM cdb_observatory._OBS_GetBoundariesByGeometry(
geom,
boundary_id,
time_span,
overlap_type
);
END;
$$ LANGUAGE plpgsql;
-- OBS_GetBoundariesByPointAndRadius
--
-- Given a point and radius, and it's geometry level (see
-- OBS_ListGeomColumns() for all available boundary ids), give back the
-- boundaries that are contained within the point buffered by radius meters and
-- the associated geometry ids
-- Inputs:
-- geom geometry: point geometry centered on area of interest
-- radius numeric: radius (in meters) of a circle centered on geom for
-- selecting polygons
-- boundary_id text: source id of boundaries (e.g., us.census.tiger.county)
-- see function OBS_ListGeomColumns for all avaiable
-- boundary ids
-- time_span text: time span that the geometries were collected (optional)
--
-- Output:
-- table with the following columns
-- boundary geometry: geometry boundary that is contained within the input
-- bounding box at the requested geometry level
-- with boundary_id, and time_span
-- geom_refs text: geometry identifiers (e.g., geoid for the US Census)
--
-- TODO: move to ST_DWithin instead of buffer + intersects?
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetBoundariesByPointAndRadius(
geom geometry(Geometry, 4326), -- point
radius numeric, -- radius in meters
boundary_id text,
time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects')
RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$
DECLARE
circle_boundary geometry(Geometry, 4326);
BEGIN
IF ST_GeometryType(geom) != 'ST_Point'
THEN
RAISE EXCEPTION 'Input geometry ''%'' is not a point', ST_AsText(geom);
ELSE
circle_boundary := ST_Buffer(geom::geography, radius)::geometry;
END IF;
RETURN QUERY SELECT *
FROM cdb_observatory._OBS_GetBoundariesByGeometry(
circle_boundary,
boundary_id,
time_span);
END;
$$ LANGUAGE plpgsql;
-- _OBS_GetPointsByGeometry
CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetPointsByGeometry(
geom geometry(Geometry, 4326),
boundary_id text,
time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects')
RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$
DECLARE
boundary geometry(Geometry, 4326);
geom_colname text;
geoid_colname text;
target_table text;
BEGIN
IF lower(overlap_type) NOT IN ('contains', 'within', 'intersects')
THEN
RAISE EXCEPTION 'Overlap type ''%'' is not an accepted type (choose intersects, within, or contains)', overlap_type;
ELSIF ST_GeometryType(geom) NOT IN ('ST_Polygon', 'ST_MultiPolygon')
THEN
RAISE EXCEPTION 'Invalid geometry type (%), expecting ''ST_MultiPolygon'' or ''ST_Polygon''', ST_GeometryType(geom);
END IF;
SELECT * INTO geoid_colname, target_table, geom_colname
FROM cdb_observatory._OBS_GetGeometryMetadata(boundary_id);
-- if no tables are found, raise notice and return null
IF target_table IS NULL
THEN
RAISE NOTICE 'No boundaries found for bounding box ''%'' in ''%''', ST_AsText(geom), boundary_id;
RETURN QUERY SELECT NULL::geometry, NULL::text;
END IF;
RAISE NOTICE 'target_table: %', target_table;
-- return first boundary in intersections
RETURN QUERY
EXECUTE format(
'SELECT ST_PointOnSurface(t.%s) As %s, t.%s
FROM observatory.%s As t
WHERE ST_%s($1, t.the_geom)
', geom_colname, geom_colname, geoid_colname, target_table, overlap_type)
USING geom;
END;
$$ LANGUAGE plpgsql;
-- OBS_GetPointsByGeometry
--
-- Given a polygon, and it's geometry level (see
-- OBS_ListGeomColumns() for all available boundary ids), give back a point
-- which lies in a boundary from the requested geometry level that is contained
-- within the bounding box polygon and the associated geometry ids
--
-- Inputs:
-- geom geometry: bounding box (or polygon) of the region of interest
-- boundary_id text: source id of boundaries (e.g., us.census.tiger.county)
-- see function OBS_ListGeomColumns for all avaiable
-- boundary ids
-- time_span text: time span that the geometries were collected (optional)
--
-- Output:
-- table with the following columns
-- boundary geometry: point that lies on a boundary that is contained within
-- the input bounding box at the requested geometry
-- level with boundary_id, and time_span
-- geom_refs text: geometry identifiers (e.g., geoid for the US Census)
--
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByGeometry(
geom geometry(Geometry, 4326),
boundary_id text,
time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects')
RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$
BEGIN
RETURN QUERY SELECT *
FROM cdb_observatory._OBS_GetPointsByGeometry(
geom,
boundary_id,
time_span,
overlap_type);
END;
$$ LANGUAGE plpgsql;
-- OBS_GetBoundariesByPointAndRadius
--
-- Given a point and radius, and it's geometry level (see
-- OBS_ListGeomColumns() for all available boundary ids), give back the
-- boundaries that are contained within the point buffered by radius meters and
-- the associated geometry ids
-- Inputs:
-- geom geometry: point geometry centered on area of interest
-- radius numeric: radius (in meters) of a circle centered on geom for
-- selecting polygons
-- boundary_id text: source id of boundaries (e.g., us.census.tiger.county)
-- see function OBS_ListGeomColumns for all avaiable
-- boundary ids
-- time_span text: time span that the geometries were collected (optional)
--
-- Output:
-- table with the following columns
-- boundary geometry: geometry boundary that is contained within the input
-- bounding box at the requested geometry level
-- with boundary_id, and time_span
-- geom_refs text: geometry identifiers (e.g., geoid for the US Census)
--
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_GetPointsByPointAndRadius(
geom geometry(Geometry, 4326), -- point
radius numeric, -- radius in meters
boundary_id text,
time_span text DEFAULT NULL,
overlap_type text DEFAULT 'intersects')
RETURNS TABLE(the_geom geometry, geom_refs text)
AS $$
DECLARE
circle_boundary geometry(Geometry, 4326);
BEGIN
IF ST_GeometryType(geom) != 'ST_Point'
THEN
RAISE EXCEPTION 'Input geometry ''%'' is not a point', ST_AsText(geom);
ELSE
circle_boundary := ST_Buffer(geom::geography, radius)::geometry;
END IF;
RETURN QUERY SELECT *
FROM cdb_observatory._OBS_GetPointsByGeometry(
ST_Buffer(geom::geography, radius)::geometry,
boundary_id,
time_span,
overlap_type);
END;
$$ LANGUAGE plpgsql;
-- _OBS_GetGeometryMetadata()
-- TODO: add timespan in search
-- TODO: add choice of clipped versus not clipped
CREATE OR REPLACE FUNCTION cdb_observatory._OBS_GetGeometryMetadata(boundary_id text)
RETURNS table(geoid_colname text, target_table text, geom_colname text)
AS $$
BEGIN
RETURN QUERY
EXECUTE
format($string$
SELECT geoid_ct.colname As geoid_colname,
tablename,
geom_ct.colname As geom_colname
FROM observatory.obs_column_table As geoid_ct,
observatory.obs_table As geom_t,
observatory.obs_column_table As geom_ct,
observatory.obs_column As geom_c
WHERE geoid_ct.column_id
IN (
SELECT source_id
FROM observatory.obs_column_to_column
WHERE reltype = 'geom_ref'
AND target_id = '%s'
)
AND geoid_ct.table_id = geom_t.id AND
geom_t.id = geom_ct.table_id AND
geom_ct.column_id = geom_c.id AND
geom_c.type ILIKE 'geometry'
LIMIT 1
$string$, boundary_id);
-- AND geom_t.timespan = '%s' <-- put in requested year
-- TODO: filter by clipped vs. not so appropriate tablename are unique
-- so the limit 1 can be removed
END;
$$ LANGUAGE plpgsql;

View File

@@ -122,9 +122,9 @@ Done.
Wealthy, urban without Kids
(1 row)
obs_getcategory
-----------------------------
Wealthy, urban without Kids
obs_getcategory
-------------------------------
Low income, mix of minorities
(1 row)
obs_getpopulation
@@ -152,9 +152,9 @@ Done.
Wealthy, urban without Kids
(1 row)
obs_getuscensuscategory
-----------------------------
Wealthy, urban without Kids
obs_getuscensuscategory
-------------------------------
Low income, mix of minorities
(1 row)
Dropping obs_table.sql fixture table...

View File

@@ -69,6 +69,51 @@ t
obs_getboundarybyid_boundary_id_mismatch_geom_id
t
(1 row)
_obs_getboundariesbygeometry_tracts_around_cartodb
t
(1 row)
_obs_getboundariesbygeometry_tracts_around_null_island
t
(1 row)
obs_getboundariesbygeometry_tracts_around_cartodb
t
(1 row)
obs_getboundariesbygeometry_tracts_around_null_island
t
(1 row)
obs_getboundariesbypointandradius_around_cartodb
t
(1 row)
obs_getboundariesbypointandradius_around_null_island
t
(1 row)
_obs_getpointsbygeometry_around_cartodb
t
(1 row)
_obs_getpointsbygeometry_around_null_island
t
(1 row)
obs_getpointsbygeometry_around_cartodb
t
(1 row)
obs_getpointsbygeometry_around_cartodb_2013
t
(1 row)
obs_getpointsbygeometry_around_null_island
t
(1 row)
obs_getpointsbypointandradius_around_cartodb
t
(1 row)
obs_getpointsbypointandradius_around_cartodb_2013
t
(1 row)
obs_getpointsbypointandradius_around_null_island
t
(1 row)
geoid_name_matches|table_name_matches|geom_name_matches
t|t|t
(1 row)
Dropping obs_table.sql fixture table...
Done.
Dropping obs_column.sql fixture table...

View File

@@ -1,7 +1,12 @@
CREATE TABLE IF NOT EXISTS obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d (
cartodb_id integer NOT NULL,
the_geom public.geometry(Geometry,4326),
the_geom_webmercator public.geometry(Geometry,3857),
--
-- id: "us.census.spielman_singleton_segments".spielman_singleton_table_99914b932b
--
CREATE TABLE obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d (
cartodb_id integer,
the_geom geometry(Geometry,4326),
the_geom_webmercator geometry(Geometry,3857),
geoid text,
x10 text,
x2 text,
@@ -9,8 +14,769 @@ CREATE TABLE IF NOT EXISTS obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d (
x55 text
);
INSERT INTO obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d (cartodb_id, the_geom,
the_geom_webmercator, geoid, x10, x2, x31, x55) VALUES (2150, NULL, NULL, '36047048500', 'Wealthy, urban without Kids', '8', '15', '1');
COPY obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d (cartodb_id, the_geom, the_geom_webmercator, geoid, x10, x2, x31, x55) FROM stdin;
302 \N \N 36047066600 \N \N \N \N
303 \N \N 36047096000 \N \N \N \N
304 \N \N 36047118000 \N \N \N \N
305 \N \N 36047040700 \N \N \N \N
306 \N \N 36047008600 \N \N \N \N
307 \N \N 36047015400 \N \N \N \N
308 \N \N 36047085200 \N \N \N \N
309 \N \N 36047017700 \N \N \N \N
310 \N \N 36047070203 \N \N \N \N
2094 \N \N 36047034000 Wealthy, urban without Kids 28 42 1
2095 \N \N 36047054300 Wealthy, urban without Kids 28 42 1
2096 \N \N 36047054900 Wealthy, urban without Kids 8 15 1
2097 \N \N 36047055100 Wealthy, urban without Kids 8 15 1
2098 \N \N 36047055300 Wealthy, urban without Kids 8 15 1
2099 \N \N 36047055500 Wealthy, urban without Kids 8 15 1
2100 \N \N 36047055700 Wealthy, urban without Kids 8 15 1
2101 \N \N 36047056300 Wealthy, urban without Kids 8 15 1
2102 \N \N 36047000100 Wealthy, urban without Kids 28 42 1
2103 \N \N 36047000301 Wealthy, urban without Kids 28 42 1
2104 \N \N 36047000700 Wealthy, urban without Kids 8 15 1
2105 \N \N 36047000900 Wealthy, urban without Kids 28 42 1
2106 \N \N 36047001100 Wealthy, urban without Kids 28 42 1
2107 \N \N 36047001300 Wealthy, urban without Kids 8 11 1
2108 \N \N 36047002100 Wealthy, urban without Kids 28 42 1
2109 \N \N 36047019100 Wealthy, urban without Kids 8 15 1
2110 \N \N 36047019500 Wealthy, urban without Kids 8 15 1
2111 \N \N 36047019700 Wealthy, urban without Kids 8 15 1
2112 \N \N 36047019900 Wealthy, urban without Kids 8 15 1
2113 \N \N 36047020100 Wealthy, urban without Kids 8 15 1
2114 \N \N 36047020300 Wealthy, urban without Kids 8 15 1
2115 \N \N 36047020500 Wealthy, urban without Kids 8 15 1
2116 \N \N 36047020700 Wealthy, urban without Kids 8 15 1
2117 \N \N 36047094402 Wealthy, urban without Kids 28 42 1
2118 \N \N 36047098200 Wealthy, urban without Kids 28 42 1
2120 \N \N 36047035200 Wealthy, urban without Kids 28 42 1
2121 \N \N 36047035700 Wealthy, urban without Kids 28 42 1
2122 \N \N 36047056500 Wealthy, urban without Kids 8 15 1
2123 \N \N 36047056900 Wealthy, urban without Kids 8 15 1
2124 \N \N 36047057100 Wealthy, urban without Kids 8 15 1
2125 \N \N 36047057200 Wealthy, urban without Kids 28 42 1
2126 \N \N 36047057300 Wealthy, urban without Kids 8 15 1
2127 \N \N 36047057500 Wealthy, urban without Kids 8 15 1
2128 \N \N 36047057900 Wealthy, urban without Kids 8 15 1
2129 \N \N 36047058900 Wealthy, urban without Kids 8 15 1
2130 \N \N 36047059100 Wealthy, urban without Kids 8 15 1
2131 \N \N 36047059300 Wealthy, urban without Kids 8 15 1
2132 \N \N 36047003300 Wealthy, urban without Kids 8 15 1
2133 \N \N 36047003700 Wealthy, urban without Kids 28 42 1
2134 \N \N 36047003900 Wealthy, urban without Kids 8 15 1
2135 \N \N 36047004100 Wealthy, urban without Kids 8 15 1
2136 \N \N 36047004300 Wealthy, urban without Kids 8 15 1
2137 \N \N 36047004500 Wealthy, urban without Kids 8 15 1
2138 \N \N 36047004700 Wealthy, urban without Kids 8 15 1
2139 \N \N 36047004900 Wealthy, urban without Kids 8 15 1
2140 \N \N 36047005100 Wealthy, urban without Kids 8 15 1
2141 \N \N 36047022100 Wealthy, urban without Kids 8 15 1
2142 \N \N 36047022700 Wealthy, urban without Kids 8 15 1
2143 \N \N 36047022900 Wealthy, urban without Kids 8 15 1
2144 \N \N 36047023100 Wealthy, urban without Kids 8 15 1
2145 \N \N 36047023500 Wealthy, urban without Kids 8 15 1
2146 \N \N 36047024100 Wealthy, urban without Kids 8 15 1
2147 \N \N 36047103400 Wealthy, urban without Kids 28 42 1
2148 \N \N 36047110600 Wealthy, urban without Kids 28 42 1
2149 \N \N 36047011900 Wealthy, urban without Kids 8 15 1
2150 \N \N 36047048500 Wealthy, urban without Kids 8 15 1
2151 \N \N 36047056100 Wealthy, urban without Kids 8 15 1
2152 \N \N 36047080800 Wealthy, urban without Kids 28 42 1
2153 \N \N 36047150200 Wealthy, urban without Kids 8 15 1
2154 \N \N 36047005900 Wealthy, urban without Kids 8 15 1
2155 \N \N 36047006300 Wealthy, urban without Kids 8 15 1
2156 \N \N 36047006500 Wealthy, urban without Kids 8 15 1
2157 \N \N 36047006700 Wealthy, urban without Kids 8 15 1
2158 \N \N 36047006900 Wealthy, urban without Kids 8 15 1
2159 \N \N 36047007200 Wealthy, urban without Kids 28 42 1
2160 \N \N 36047007500 Wealthy, urban without Kids 8 15 1
2161 \N \N 36047007700 Wealthy, urban without Kids 8 15 1
2162 \N \N 36047008500 Wealthy, urban without Kids 28 42 1
2163 \N \N 36047025500 Wealthy, urban without Kids 28 42 1
2164 \N \N 36047025902 Wealthy, urban without Kids 28 42 1
2165 \N \N 36047030500 Wealthy, urban without Kids 8 15 1
2166 \N \N 36047000501 Wealthy, urban without Kids 28 42 1
2167 \N \N 36047000502 Wealthy, urban without Kids 28 42 1
2168 \N \N 36047001500 Wealthy, urban without Kids 8 11 1
2169 \N \N 36047050801 Wealthy, urban without Kids 28 42 1
2170 \N \N 36047051001 Wealthy, urban without Kids 28 42 1
2171 \N \N 36047028502 Wealthy, urban without Kids 28 42 1
2172 \N \N 36047049500 Wealthy, urban without Kids 8 15 1
2173 \N \N 36047049700 Wealthy, urban without Kids 8 15 1
2174 \N \N 36047049900 Wealthy, urban without Kids 8 15 1
2175 \N \N 36047050000 Wealthy, urban without Kids 8 15 1
2176 \N \N 36047050100 Wealthy, urban without Kids 8 15 1
2177 \N \N 36047042500 Wealthy, urban without Kids 8 15 1
2178 \N \N 36047042900 Wealthy, urban without Kids 28 42 1
2179 \N \N 36047011700 Wealthy, urban without Kids 8 15 1
2180 \N \N 36047012100 Wealthy, urban without Kids 8 15 1
2181 \N \N 36047012901 Wealthy, urban without Kids 8 15 1
2182 \N \N 36047012902 Wealthy, urban without Kids 8 15 1
2183 \N \N 36047013100 Wealthy, urban without Kids 8 15 1
2184 \N \N 36047050300 Wealthy, urban without Kids 8 15 1
2185 \N \N 36047051300 Wealthy, urban without Kids 8 15 1
2186 \N \N 36047051500 Wealthy, urban without Kids 8 15 1
2187 \N \N 36047051700 Wealthy, urban without Kids 8 15 1
2188 \N \N 36047051900 Wealthy, urban without Kids 8 15 1
2189 \N \N 36047045300 Wealthy, urban without Kids 8 15 1
2190 \N \N 36047047700 Wealthy, urban without Kids 8 15 1
2191 \N \N 36047048100 Wealthy, urban without Kids 8 15 1
2192 \N \N 36047013300 Wealthy, urban without Kids 8 15 1
2193 \N \N 36047013500 Wealthy, urban without Kids 8 15 1
2194 \N \N 36047013700 Wealthy, urban without Kids 8 15 1
2195 \N \N 36047013900 Wealthy, urban without Kids 8 15 1
2196 \N \N 36047014100 Wealthy, urban without Kids 8 15 1
2197 \N \N 36047014300 Wealthy, urban without Kids 8 15 1
2198 \N \N 36047014500 Wealthy, urban without Kids 8 15 1
2199 \N \N 36047014700 Wealthy, urban without Kids 8 15 1
2200 \N \N 36047014900 Wealthy, urban without Kids 8 15 1
2201 \N \N 36047015100 Wealthy, urban without Kids 8 15 1
2202 \N \N 36047015300 Wealthy, urban without Kids 8 15 1
2203 \N \N 36047015500 Wealthy, urban without Kids 8 15 1
2204 \N \N 36047015700 Wealthy, urban without Kids 8 15 1
2205 \N \N 36047015900 Wealthy, urban without Kids 8 15 1
2206 \N \N 36047016100 Wealthy, urban without Kids 8 15 1
2207 \N \N 36047121000 Wealthy, urban without Kids 28 42 1
2208 \N \N 36047121400 Wealthy, urban without Kids 28 42 1
2209 \N \N 36047051601 Wealthy, urban without Kids 28 42 1
2210 \N \N 36047016300 Wealthy, urban without Kids 8 15 1
2211 \N \N 36047016400 Wealthy, urban without Kids 28 42 1
2212 \N \N 36047016500 Wealthy, urban without Kids 8 15 1
2213 \N \N 36047016700 Wealthy, urban without Kids 8 15 1
2214 \N \N 36047016900 Wealthy, urban without Kids 8 15 1
2215 \N \N 36047017100 Wealthy, urban without Kids 8 15 1
2216 \N \N 36047018100 Wealthy, urban without Kids 8 15 1
2217 \N \N 36047018300 Wealthy, urban without Kids 8 15 1
2218 \N \N 36047018700 Wealthy, urban without Kids 8 15 1
2219 \N \N 36047090600 Wealthy, urban without Kids 28 42 1
2220 \N \N 36047090800 Wealthy, urban without Kids 28 42 1
2221 \N \N 36047091200 Wealthy, urban without Kids 28 42 1
28199 \N \N 36047065600 Middle Income, Single Family Home 6 12 2
28208 \N \N 36047070202 Middle Income, Single Family Home 5 5 2
54632 \N \N 36047075200 Wealthy Nuclear Families 24 36 2
54633 \N \N 36047075400 Wealthy Nuclear Families 24 36 2
54649 \N \N 36047062000 Wealthy Nuclear Families 24 36 2
54650 \N \N 36047005300 Wealthy Nuclear Families 13 22 2
57998 \N \N 36047035000 Wealthy Old Caucasion 11 49 2
57999 \N \N 36047019300 Wealthy Old Caucasion 11 49 2
58000 \N \N 36047077600 Wealthy Old Caucasion 11 49 2
58002 \N \N 36047035400 Wealthy Old Caucasion 11 49 2
58003 \N \N 36047036001 Wealthy Old Caucasion 11 49 2
58004 \N \N 36047036002 Wealthy Old Caucasion 11 49 2
58005 \N \N 36047057000 Wealthy Old Caucasion 11 49 2
58006 \N \N 36047058800 Wealthy Old Caucasion 11 49 2
58007 \N \N 36047003100 Wealthy Old Caucasion 11 49 2
58008 \N \N 36047003600 Wealthy Old Caucasion 11 49 2
58009 \N \N 36047060600 Wealthy Old Caucasion 11 49 2
58010 \N \N 36047005201 Wealthy Old Caucasion 11 49 2
58011 \N \N 36047005202 Wealthy Old Caucasion 11 49 2
58012 \N \N 36047004400 Wealthy Old Caucasion 14 21 2
58013 \N \N 36047059600 Wealthy Old Caucasion 11 49 2
58014 \N \N 36047060800 Wealthy Old Caucasion 11 49 2
58015 \N \N 36047061200 Wealthy Old Caucasion 14 21 2
58016 \N \N 36047062200 Wealthy Old Caucasion 11 49 2
58017 \N \N 36047063200 Wealthy Old Caucasion 11 49 2
58018 \N \N 36047005601 Wealthy Old Caucasion 11 49 2
58019 \N \N 36047105804 Wealthy Old Caucasion 11 49 2
58020 \N \N 36047035601 Wealthy Old Caucasion 11 49 2
58021 \N \N 36047035602 Wealthy Old Caucasion 11 49 2
58022 \N \N 36047037401 Wealthy Old Caucasion 11 49 2
58023 \N \N 36047037402 Wealthy Old Caucasion 11 49 2
58024 \N \N 36047029400 Wealthy Old Caucasion 11 49 2
58025 \N \N 36047030800 Wealthy Old Caucasion 11 49 2
58026 \N \N 36047031400 Wealthy Old Caucasion 11 49 2
58027 \N \N 36047046201 Wealthy Old Caucasion 11 49 2
58028 \N \N 36047004600 Wealthy Old Caucasion 14 21 2
58029 \N \N 36047061002 Wealthy Old Caucasion 11 49 2
58030 \N \N 36047061600 Wealthy Old Caucasion 14 21 2
58031 \N \N 36047061004 Wealthy Old Caucasion 11 49 2
58032 \N \N 36047105801 Wealthy Old Caucasion 11 49 2
58033 \N \N 36047072800 Wealthy Old Caucasion 11 49 2
65333 \N \N 36047053500 Hispanic and Young 21 54 1
65334 \N \N 36047053700 Hispanic and Young 21 54 1
65335 \N \N 36047053900 Hispanic and Young 21 54 1
65336 \N \N 36047054700 Hispanic and Young 21 54 1
65337 \N \N 36047000200 Hispanic and Young 21 32 1
65338 \N \N 36047001800 Hispanic and Young 3 3 1
65339 \N \N 36047002000 Hispanic and Young 21 32 1
65340 \N \N 36047021800 Hispanic and Young 21 54 1
65341 \N \N 36047036200 Hispanic and Young 21 32 1
65342 \N \N 36047002200 Hispanic and Young 21 32 1
65343 \N \N 36047022000 Hispanic and Young 21 54 1
65344 \N \N 36047022200 Hispanic and Young 21 54 1
65345 \N \N 36047022400 Hispanic and Young 21 54 1
65346 \N \N 36047022600 Hispanic and Young 21 32 1
65347 \N \N 36047022800 Hispanic and Young 21 54 1
65348 \N \N 36047023000 Hispanic and Young 21 54 1
65349 \N \N 36047023200 Hispanic and Young 21 54 1
65350 \N \N 36047023400 Hispanic and Young 21 54 1
65351 \N \N 36047023600 Hispanic and Young 21 54 1
65352 \N \N 36047023800 Hispanic and Young 21 54 1
65353 \N \N 36047024000 Hispanic and Young 21 54 1
65354 \N \N 36047024200 Hispanic and Young 21 54 1
65355 \N \N 36047024400 Hispanic and Young 21 54 1
65356 \N \N 36047021100 Hispanic and Young 21 32 1
65357 \N \N 36047123700 Hispanic and Young 21 54 1
65358 \N \N 36047038900 Hispanic and Young 21 32 1
65359 \N \N 36047039100 Hispanic and Young 21 32 1
65360 \N \N 36047039500 Hispanic and Young 21 32 1
65361 \N \N 36047007400 Hispanic and Young 21 32 1
65362 \N \N 36047007600 Hispanic and Young 21 32 1
65363 \N \N 36047007800 Hispanic and Young 21 32 1
65364 \N \N 36047008000 Hispanic and Young 21 32 1
65365 \N \N 36047008200 Hispanic and Young 21 32 1
65366 \N \N 36047008400 Hispanic and Young 21 32 1
65367 \N \N 36047117400 Hispanic and Young 21 32 1
65368 \N \N 36047117601 Hispanic and Young 21 32 1
65369 \N \N 36047034800 Hispanic and Young 21 34 1
65372 \N \N 36047040900 Hispanic and Young 21 32 1
65373 \N \N 36047042100 Hispanic and Young 21 32 1
65374 \N \N 36047042300 Hispanic and Young 21 32 1
65375 \N \N 36047042700 Hispanic and Young 21 32 1
65376 \N \N 36047043100 Hispanic and Young 21 32 1
65377 \N \N 36047043300 Hispanic and Young 21 32 1
65378 \N \N 36047043500 Hispanic and Young 21 32 1
65379 \N \N 36047043700 Hispanic and Young 21 32 1
65380 \N \N 36047043900 Hispanic and Young 21 32 1
65381 \N \N 36047044100 Hispanic and Young 21 32 1
65382 \N \N 36047044300 Hispanic and Young 21 32 1
65383 \N \N 36047008800 Hispanic and Young 21 32 1
65384 \N \N 36047009000 Hispanic and Young 21 32 1
65385 \N \N 36047009600 Hispanic and Young 21 32 1
65386 \N \N 36047009800 Hispanic and Young 21 32 1
65387 \N \N 36047010100 Hispanic and Young 21 32 1
65388 \N \N 36047012200 Hispanic and Young 21 32 1
65389 \N \N 36047050700 Hispanic and Young 21 54 1
65390 \N \N 36047050900 Hispanic and Young 21 54 1
65391 \N \N 36047052900 Hispanic and Young 21 54 1
65392 \N \N 36047053100 Hispanic and Young 21 54 1
65393 \N \N 36047053300 Hispanic and Young 21 54 1
65394 \N \N 36047044500 Hispanic and Young 21 32 1
65395 \N \N 36047044700 Hispanic and Young 21 32 1
65396 \N \N 36047045000 Hispanic and Young 21 34 1
65397 \N \N 36047046400 Hispanic and Young 21 54 1
65398 \N \N 36047046800 Hispanic and Young 21 54 1
65399 \N \N 36047047000 Hispanic and Young 21 54 1
65400 \N \N 36047047200 Hispanic and Young 21 54 1
65401 \N \N 36047047400 Hispanic and Young 21 54 1
65402 \N \N 36047047600 Hispanic and Young 21 54 1
65403 \N \N 36047047800 Hispanic and Young 21 54 1
65404 \N \N 36047017500 Hispanic and Young 3 3 1
70605 \N \N 36047031500 Low income, mix of minorities 22 33 1
70606 \N \N 36047031701 Low income, mix of minorities 27 41 1
70607 \N \N 36047031702 Low income, mix of minorities 27 41 1
70608 \N \N 36047031900 Low income, mix of minorities 27 41 1
70609 \N \N 36047032100 Low income, mix of minorities 22 33 1
70610 \N \N 36047032300 Low income, mix of minorities 22 33 1
70611 \N \N 36047032500 Low income, mix of minorities 22 33 1
70612 \N \N 36047032600 Low income, mix of minorities 22 33 1
70613 \N \N 36047032700 Low income, mix of minorities 22 33 1
70614 \N \N 36047032800 Low income, mix of minorities 22 33 1
70615 \N \N 36047032900 Low income, mix of minorities 22 33 1
70616 \N \N 36047033000 Low income, mix of minorities 22 33 1
70617 \N \N 36047033100 Low income, mix of minorities 22 33 1
70618 \N \N 36047033300 Low income, mix of minorities 19 29 1
70619 \N \N 36047033500 Low income, mix of minorities 19 29 1
70620 \N \N 36047033600 Low income, mix of minorities 19 29 1
70621 \N \N 36047033700 Low income, mix of minorities 27 41 1
70622 \N \N 36047033900 Low income, mix of minorities 27 41 1
70623 \N \N 36047034100 Low income, mix of minorities 27 41 1
70624 \N \N 36047034200 Low income, mix of minorities 22 33 1
70625 \N \N 36047034300 Low income, mix of minorities 22 33 1
70626 \N \N 36047034500 Low income, mix of minorities 27 41 1
70627 \N \N 36047034700 Low income, mix of minorities 22 33 1
70628 \N \N 36047034900 Low income, mix of minorities 22 33 1
70629 \N \N 36047035100 Low income, mix of minorities 22 33 1
70630 \N \N 36047053400 Low income, mix of minorities 19 29 1
70631 \N \N 36047053800 Low income, mix of minorities 22 33 1
70632 \N \N 36047054200 Low income, mix of minorities 19 29 1
70633 \N \N 36047054400 Low income, mix of minorities 19 29 1
70634 \N \N 36047054500 Low income, mix of minorities 22 33 1
70635 \N \N 36047054800 Low income, mix of minorities 19 29 1
70636 \N \N 36047055000 Low income, mix of minorities 19 29 1
70637 \N \N 36047055200 Low income, mix of minorities 22 33 1
70638 \N \N 36047055400 Low income, mix of minorities 22 33 1
70639 \N \N 36047055600 Low income, mix of minorities 19 29 1
70640 \N \N 36047055800 Low income, mix of minorities 19 29 1
70641 \N \N 36047056000 Low income, mix of minorities 19 29 1
70642 \N \N 36047056200 Low income, mix of minorities 19 29 1
70643 \N \N 36047056400 Low income, mix of minorities 19 29 1
70644 \N \N 36047048600 Low income, mix of minorities 19 29 1
70645 \N \N 36047048800 Low income, mix of minorities 19 29 1
70646 \N \N 36047048900 Low income, mix of minorities 22 33 1
70647 \N \N 36047049000 Low income, mix of minorities 22 33 1
70648 \N \N 36047049100 Low income, mix of minorities 22 33 1
70649 \N \N 36047049200 Low income, mix of minorities 19 29 1
70650 \N \N 36047075800 Low income, mix of minorities 19 29 1
70651 \N \N 36047018800 Low income, mix of minorities 19 29 1
70652 \N \N 36047019000 Low income, mix of minorities 19 29 1
70653 \N \N 36047019200 Low income, mix of minorities 19 29 1
70654 \N \N 36047019400 Low income, mix of minorities 19 29 1
70655 \N \N 36047019600 Low income, mix of minorities 19 29 1
70656 \N \N 36047019800 Low income, mix of minorities 19 29 1
70657 \N \N 36047020000 Low income, mix of minorities 19 29 1
70658 \N \N 36047020200 Low income, mix of minorities 19 29 1
70659 \N \N 36047020400 Low income, mix of minorities 19 29 1
70660 \N \N 36047020600 Low income, mix of minorities 19 29 1
70661 \N \N 36047020800 Low income, mix of minorities 19 29 1
70662 \N \N 36047021000 Low income, mix of minorities 19 29 1
70663 \N \N 36047021200 Low income, mix of minorities 19 29 1
70664 \N \N 36047021300 Low income, mix of minorities 22 33 1
70665 \N \N 36047021400 Low income, mix of minorities 19 29 1
70666 \N \N 36047021500 Low income, mix of minorities 22 33 1
70667 \N \N 36047021600 Low income, mix of minorities 19 29 1
70668 \N \N 36047021700 Low income, mix of minorities 22 33 1
70669 \N \N 36047093000 Low income, mix of minorities 27 41 1
70670 \N \N 36047093400 Low income, mix of minorities 27 41 1
70671 \N \N 36047093600 Low income, mix of minorities 27 41 1
70672 \N \N 36047093800 Low income, mix of minorities 27 41 1
70673 \N \N 36047094401 Low income, mix of minorities 27 41 1
70674 \N \N 36047095000 Low income, mix of minorities 27 41 1
70675 \N \N 36047095400 Low income, mix of minorities 27 41 1
70676 \N \N 36047095600 Low income, mix of minorities 27 41 1
70677 \N \N 36047095800 Low income, mix of minorities 27 41 1
70678 \N \N 36047096200 Low income, mix of minorities 27 41 1
70679 \N \N 36047096400 Low income, mix of minorities 27 41 1
70680 \N \N 36047096600 Low income, mix of minorities 27 41 1
70681 \N \N 36047096800 Low income, mix of minorities 27 41 1
70682 \N \N 36047097000 Low income, mix of minorities 27 41 1
70683 \N \N 36047097400 Low income, mix of minorities 27 41 1
70684 \N \N 36047098400 Low income, mix of minorities 27 41 1
70685 \N \N 36047098600 Low income, mix of minorities 27 41 1
70686 \N \N 36047098800 Low income, mix of minorities 27 41 1
70687 \N \N 36047099000 Low income, mix of minorities 27 41 1
70688 \N \N 36047099200 Low income, mix of minorities 27 41 1
70689 \N \N 36047099400 Low income, mix of minorities 27 41 1
70690 \N \N 36047099600 Low income, mix of minorities 27 41 1
70691 \N \N 36047074600 Low income, mix of minorities 19 29 1
70692 \N \N 36047074800 Low income, mix of minorities 19 29 1
70693 \N \N 36047075000 Low income, mix of minorities 19 29 1
70694 \N \N 36047075600 Low income, mix of minorities 19 29 1
70695 \N \N 36047076000 Low income, mix of minorities 19 29 1
70696 \N \N 36047076200 Low income, mix of minorities 22 33 1
70697 \N \N 36047076400 Low income, mix of minorities 22 33 1
70698 \N \N 36047076600 Low income, mix of minorities 22 33 1
70699 \N \N 36047077000 Low income, mix of minorities 19 29 1
70700 \N \N 36047077200 Low income, mix of minorities 19 29 1
70701 \N \N 36047077400 Low income, mix of minorities 19 29 1
70702 \N \N 36047078000 Low income, mix of minorities 27 41 1
70703 \N \N 36047078200 Low income, mix of minorities 22 33 1
70704 \N \N 36047078400 Low income, mix of minorities 27 41 1
70705 \N \N 36047078600 Low income, mix of minorities 27 41 1
70706 \N \N 36047078800 Low income, mix of minorities 27 41 1
70707 \N \N 36047079000 Low income, mix of minorities 27 41 1
70708 \N \N 36047079200 Low income, mix of minorities 27 41 1
70709 \N \N 36047079400 Low income, mix of minorities 27 41 1
70710 \N \N 36047080000 Low income, mix of minorities 27 41 1
70711 \N \N 36047080200 Low income, mix of minorities 27 41 1
70712 \N \N 36047080400 Low income, mix of minorities 27 41 1
70713 \N \N 36047080600 Low income, mix of minorities 27 41 1
70715 \N \N 36047035300 Low income, mix of minorities 22 33 1
70716 \N \N 36047035500 Low income, mix of minorities 22 33 1
70717 \N \N 36047035900 Low income, mix of minorities 27 41 1
70718 \N \N 36047036100 Low income, mix of minorities 22 33 1
70719 \N \N 36047036300 Low income, mix of minorities 27 41 1
70720 \N \N 36047036400 Low income, mix of minorities 19 29 1
70721 \N \N 36047036501 Low income, mix of minorities 27 41 1
70722 \N \N 36047036502 Low income, mix of minorities 27 41 1
70723 \N \N 36047036600 Low income, mix of minorities 19 29 1
70724 \N \N 36047036700 Low income, mix of minorities 27 41 1
70725 \N \N 36047036900 Low income, mix of minorities 27 41 1
70726 \N \N 36047037000 Low income, mix of minorities 19 29 1
70727 \N \N 36047037100 Low income, mix of minorities 27 41 1
70728 \N \N 36047037300 Low income, mix of minorities 27 41 1
70729 \N \N 36047037500 Low income, mix of minorities 27 41 1
70730 \N \N 36047037700 Low income, mix of minorities 27 41 1
70731 \N \N 36047056600 Low income, mix of minorities 19 29 1
70732 \N \N 36047056800 Low income, mix of minorities 19 29 1
70733 \N \N 36047057400 Low income, mix of minorities 19 29 1
70734 \N \N 36047057600 Low income, mix of minorities 19 29 1
70735 \N \N 36047057800 Low income, mix of minorities 19 29 1
70736 \N \N 36047058000 Low income, mix of minorities 19 29 1
70737 \N \N 36047058200 Low income, mix of minorities 19 29 1
70738 \N \N 36047058400 Low income, mix of minorities 19 29 1
70739 \N \N 36047058600 Low income, mix of minorities 19 29 1
70740 \N \N 36047059000 Low income, mix of minorities 19 29 1
70741 \N \N 36047059200 Low income, mix of minorities 19 29 1
70742 \N \N 36047059401 Low income, mix of minorities 19 29 1
70743 \N \N 36047059402 Low income, mix of minorities 19 29 1
70744 \N \N 36047002300 Low income, mix of minorities 22 33 1
70745 \N \N 36047002901 Low income, mix of minorities 27 41 1
70746 \N \N 36047003000 Low income, mix of minorities 19 29 1
70747 \N \N 36047003400 Low income, mix of minorities 19 29 1
70748 \N \N 36047003500 Low income, mix of minorities 22 33 1
70749 \N \N 36047003800 Low income, mix of minorities 19 29 1
70750 \N \N 36047005000 Low income, mix of minorities 19 29 1
70751 \N \N 36047005400 Low income, mix of minorities 19 29 1
70752 \N \N 36047021900 Low income, mix of minorities 22 33 1
70753 \N \N 36047023300 Low income, mix of minorities 22 33 1
70754 \N \N 36047024300 Low income, mix of minorities 27 41 1
70755 \N \N 36047024500 Low income, mix of minorities 27 41 1
70756 \N \N 36047024600 Low income, mix of minorities 19 29 1
70757 \N \N 36047024700 Low income, mix of minorities 27 41 1
70758 \N \N 36047024800 Low income, mix of minorities 19 29 1
70759 \N \N 36047024900 Low income, mix of minorities 27 41 1
70760 \N \N 36047099800 Low income, mix of minorities 27 41 1
70761 \N \N 36047100400 Low income, mix of minorities 27 41 1
70762 \N \N 36047100600 Low income, mix of minorities 27 41 1
70763 \N \N 36047100800 Low income, mix of minorities 27 41 1
70764 \N \N 36047101000 Low income, mix of minorities 27 41 1
70765 \N \N 36047101200 Low income, mix of minorities 27 41 1
70766 \N \N 36047101400 Low income, mix of minorities 27 41 1
70767 \N \N 36047101600 Low income, mix of minorities 27 41 1
70768 \N \N 36047101800 Low income, mix of minorities 27 41 1
70769 \N \N 36047102000 Low income, mix of minorities 27 41 1
70770 \N \N 36047102200 Low income, mix of minorities 27 41 1
70771 \N \N 36047102400 Low income, mix of minorities 27 41 1
70772 \N \N 36047102600 Low income, mix of minorities 27 41 1
70773 \N \N 36047102800 Low income, mix of minorities 27 41 1
70774 \N \N 36047107000 Low income, mix of minorities 12 16 1
70775 \N \N 36047107800 Low income, mix of minorities 27 41 1
70776 \N \N 36047109800 Low income, mix of minorities 27 41 1
70777 \N \N 36047111000 Low income, mix of minorities 22 33 1
70778 \N \N 36047111800 Low income, mix of minorities 27 41 1
70779 \N \N 36047112000 Low income, mix of minorities 27 41 1
70780 \N \N 36047112200 Low income, mix of minorities 27 41 1
70781 \N \N 36047112400 Low income, mix of minorities 27 41 1
70782 \N \N 36047081000 Low income, mix of minorities 27 41 1
70783 \N \N 36047081400 Low income, mix of minorities 27 41 1
70784 \N \N 36047081600 Low income, mix of minorities 27 41 1
70785 \N \N 36047081800 Low income, mix of minorities 22 33 1
70786 \N \N 36047114400 Low income, mix of minorities 27 41 1
70787 \N \N 36047015200 Low income, mix of minorities 19 29 1
70788 \N \N 36047016600 Low income, mix of minorities 19 29 1
70789 \N \N 36047092400 Low income, mix of minorities 27 41 1
70790 \N \N 36047093200 Low income, mix of minorities 12 16 1
70791 \N \N 36047110400 Low income, mix of minorities 27 41 1
70792 \N \N 36047111600 Low income, mix of minorities 27 41 1
70793 \N \N 36047037900 Low income, mix of minorities 27 41 1
70794 \N \N 36047038100 Low income, mix of minorities 27 41 1
70795 \N \N 36047038200 Low income, mix of minorities 22 33 1
70796 \N \N 36047038300 Low income, mix of minorities 27 41 1
70797 \N \N 36047038500 Low income, mix of minorities 27 41 1
70798 \N \N 36047038600 Low income, mix of minorities 19 29 1
70799 \N \N 36047038700 Low income, mix of minorities 27 41 1
70800 \N \N 36047038800 Low income, mix of minorities 19 29 1
70801 \N \N 36047039000 Low income, mix of minorities 19 29 1
70802 \N \N 36047039200 Low income, mix of minorities 19 29 1
70803 \N \N 36047039300 Low income, mix of minorities 27 41 1
70804 \N \N 36047039400 Low income, mix of minorities 19 29 1
70805 \N \N 36047039600 Low income, mix of minorities 19 29 1
70806 \N \N 36047039700 Low income, mix of minorities 27 41 1
70807 \N \N 36047039800 Low income, mix of minorities 19 29 1
70808 \N \N 36047039900 Low income, mix of minorities 27 41 1
70809 \N \N 36047040000 Low income, mix of minorities 19 29 1
70810 \N \N 36047040100 Low income, mix of minorities 27 41 1
70811 \N \N 36047040200 Low income, mix of minorities 19 29 1
70812 \N \N 36047040300 Low income, mix of minorities 27 41 1
70813 \N \N 36047059800 Low income, mix of minorities 19 29 1
70814 \N \N 36047119000 Low income, mix of minorities 27 41 1
70815 \N \N 36047060000 Low income, mix of minorities 19 29 1
70816 \N \N 36047062800 Low income, mix of minorities 19 29 1
70817 \N \N 36047062600 Low income, mix of minorities 19 29 1
70818 \N \N 36047063600 Low income, mix of minorities 19 29 1
70819 \N \N 36047063800 Low income, mix of minorities 19 29 1
70820 \N \N 36047064000 Low income, mix of minorities 19 29 1
70821 \N \N 36047064200 Low income, mix of minorities 19 29 1
70822 \N \N 36047064400 Low income, mix of minorities 19 29 1
70823 \N \N 36047064600 Low income, mix of minorities 19 29 1
70824 \N \N 36047064800 Low income, mix of minorities 19 29 1
70825 \N \N 36047065000 Low income, mix of minorities 19 29 1
70826 \N \N 36047065200 Low income, mix of minorities 19 29 1
70827 \N \N 36047065400 Low income, mix of minorities 19 29 1
70828 \N \N 36047065800 Low income, mix of minorities 19 29 1
70829 \N \N 36047066000 Low income, mix of minorities 19 29 1
70830 \N \N 36047005602 Low income, mix of minorities 19 29 1
70831 \N \N 36047005800 Low income, mix of minorities 19 29 1
70832 \N \N 36047006000 Low income, mix of minorities 19 29 1
70833 \N \N 36047006200 Low income, mix of minorities 19 29 1
70834 \N \N 36047006400 Low income, mix of minorities 19 29 1
70835 \N \N 36047006600 Low income, mix of minorities 19 29 1
70836 \N \N 36047006800 Low income, mix of minorities 19 29 1
70837 \N \N 36047007000 Low income, mix of minorities 19 29 1
70838 \N \N 36047007100 Low income, mix of minorities 22 33 1
70839 \N \N 36047025000 Low income, mix of minorities 19 29 1
70840 \N \N 36047025100 Low income, mix of minorities 27 41 1
70841 \N \N 36047025200 Low income, mix of minorities 19 29 1
70842 \N \N 36047025300 Low income, mix of minorities 27 41 1
70843 \N \N 36047025400 Low income, mix of minorities 19 29 1
70844 \N \N 36047025600 Low income, mix of minorities 19 29 1
70845 \N \N 36047025700 Low income, mix of minorities 27 41 1
70846 \N \N 36047025800 Low income, mix of minorities 19 29 1
70847 \N \N 36047025901 Low income, mix of minorities 22 33 1
70848 \N \N 36047026000 Low income, mix of minorities 19 29 1
70849 \N \N 36047026100 Low income, mix of minorities 27 41 1
70850 \N \N 36047026200 Low income, mix of minorities 19 29 1
70851 \N \N 36047026300 Low income, mix of minorities 27 41 1
70852 \N \N 36047026400 Low income, mix of minorities 19 29 1
70853 \N \N 36047026500 Low income, mix of minorities 27 41 1
70854 \N \N 36047026600 Low income, mix of minorities 19 29 1
70855 \N \N 36047026700 Low income, mix of minorities 27 41 1
70856 \N \N 36047026800 Low income, mix of minorities 19 29 1
70857 \N \N 36047026900 Low income, mix of minorities 27 41 1
70858 \N \N 36047027000 Low income, mix of minorities 19 29 1
70859 \N \N 36047027200 Low income, mix of minorities 19 29 1
70860 \N \N 36047027300 Low income, mix of minorities 27 41 1
70861 \N \N 36047027400 Low income, mix of minorities 19 29 1
70862 \N \N 36047027500 Low income, mix of minorities 27 41 1
70863 \N \N 36047027600 Low income, mix of minorities 19 29 1
70864 \N \N 36047027700 Low income, mix of minorities 27 41 1
70865 \N \N 36047112600 Low income, mix of minorities 27 41 1
70866 \N \N 36047112800 Low income, mix of minorities 27 41 1
70867 \N \N 36047113000 Low income, mix of minorities 27 41 1
70868 \N \N 36047113200 Low income, mix of minorities 27 41 1
70869 \N \N 36047113400 Low income, mix of minorities 22 33 1
70870 \N \N 36047114201 Low income, mix of minorities 19 29 1
70871 \N \N 36047114202 Low income, mix of minorities 22 33 1
70872 \N \N 36047114600 Low income, mix of minorities 27 41 1
70873 \N \N 36047115000 Low income, mix of minorities 27 41 1
70874 \N \N 36047115200 Low income, mix of minorities 27 41 1
70875 \N \N 36047115600 Low income, mix of minorities 22 33 1
70876 \N \N 36047115800 Low income, mix of minorities 27 41 1
70877 \N \N 36047116000 Low income, mix of minorities 27 41 1
70878 \N \N 36047116200 Low income, mix of minorities 27 41 1
70879 \N \N 36047116400 Low income, mix of minorities 27 41 1
70880 \N \N 36047116600 Low income, mix of minorities 27 41 1
70881 \N \N 36047116800 Low income, mix of minorities 27 41 1
70882 \N \N 36047117000 Low income, mix of minorities 19 29 1
70883 \N \N 36047117201 Low income, mix of minorities 19 29 1
70884 \N \N 36047117202 Low income, mix of minorities 27 41 1
70885 \N \N 36047117602 Low income, mix of minorities 19 29 1
70886 \N \N 36047117800 Low income, mix of minorities 19 29 1
70887 \N \N 36047012600 Low income, mix of minorities 19 29 1
70888 \N \N 36047027100 Low income, mix of minorities 27 41 1
70889 \N \N 36047044900 Low income, mix of minorities 22 33 1
70890 \N \N 36047046000 Low income, mix of minorities 19 29 1
70891 \N \N 36047076800 Low income, mix of minorities 19 29 1
70892 \N \N 36047094600 Low income, mix of minorities 27 41 1
70893 \N \N 36047119800 Low income, mix of minorities 27 41 1
70894 \N \N 36047152200 Low income, mix of minorities 19 29 1
70895 \N \N 36047050803 Low income, mix of minorities 22 33 1
70896 \N \N 36047050804 Low income, mix of minorities 22 33 1
70897 \N \N 36047028200 Low income, mix of minorities 19 29 1
70898 \N \N 36047028300 Low income, mix of minorities 22 33 1
70899 \N \N 36047028400 Low income, mix of minorities 19 29 1
70900 \N \N 36047028501 Low income, mix of minorities 19 29 1
70901 \N \N 36047028600 Low income, mix of minorities 19 29 1
70902 \N \N 36047028700 Low income, mix of minorities 22 33 1
70904 \N \N 36047028800 Low income, mix of minorities 19 29 1
70905 \N \N 36047028900 Low income, mix of minorities 27 41 1
70906 \N \N 36047029000 Low income, mix of minorities 19 29 1
70907 \N \N 36047029100 Low income, mix of minorities 27 41 1
70908 \N \N 36047029200 Low income, mix of minorities 19 29 1
70909 \N \N 36047029300 Low income, mix of minorities 27 41 1
70910 \N \N 36047029500 Low income, mix of minorities 27 41 1
70911 \N \N 36047029600 Low income, mix of minorities 19 29 1
70912 \N \N 36047029700 Low income, mix of minorities 27 41 1
70913 \N \N 36047029800 Low income, mix of minorities 19 29 1
70914 \N \N 36047029900 Low income, mix of minorities 27 41 1
70915 \N \N 36047030000 Low income, mix of minorities 19 29 1
70916 \N \N 36047030100 Low income, mix of minorities 27 41 1
70917 \N \N 36047030200 Low income, mix of minorities 19 29 1
70918 \N \N 36047030300 Low income, mix of minorities 27 41 1
70919 \N \N 36047030400 Low income, mix of minorities 19 29 1
70920 \N \N 36047030600 Low income, mix of minorities 19 29 1
70921 \N \N 36047030700 Low income, mix of minorities 22 33 1
70922 \N \N 36047030900 Low income, mix of minorities 27 41 1
70923 \N \N 36047031100 Low income, mix of minorities 27 41 1
70924 \N \N 36047031300 Low income, mix of minorities 22 33 1
70925 \N \N 36047040400 Low income, mix of minorities 19 29 1
70926 \N \N 36047040500 Low income, mix of minorities 19 29 1
70927 \N \N 36047040600 Low income, mix of minorities 19 29 1
70928 \N \N 36047040800 Low income, mix of minorities 19 29 1
70929 \N \N 36047041000 Low income, mix of minorities 19 29 1
70930 \N \N 36047041100 Low income, mix of minorities 27 41 1
70931 \N \N 36047041200 Low income, mix of minorities 19 29 1
70932 \N \N 36047041300 Low income, mix of minorities 27 41 1
70933 \N \N 36047041401 Low income, mix of minorities 22 33 1
70934 \N \N 36047041402 Low income, mix of minorities 19 29 1
70935 \N \N 36047041500 Low income, mix of minorities 27 41 1
70936 \N \N 36047041600 Low income, mix of minorities 19 29 1
70937 \N \N 36047041700 Low income, mix of minorities 22 33 1
70938 \N \N 36047041800 Low income, mix of minorities 19 29 1
70939 \N \N 36047041900 Low income, mix of minorities 22 33 1
70940 \N \N 36047049300 Low income, mix of minorities 22 33 1
70941 \N \N 36047049400 Low income, mix of minorities 22 33 1
70942 \N \N 36047049600 Low income, mix of minorities 19 29 1
70943 \N \N 36047049800 Low income, mix of minorities 19 29 1
70944 \N \N 36047050202 Low income, mix of minorities 19 29 1
70945 \N \N 36047066200 Low income, mix of minorities 19 29 1
70946 \N \N 36047067000 Low income, mix of minorities 19 29 1
70947 \N \N 36047042000 Low income, mix of minorities 19 29 1
70948 \N \N 36047042200 Low income, mix of minorities 19 29 1
70949 \N \N 36047042400 Low income, mix of minorities 19 29 1
70950 \N \N 36047042600 Low income, mix of minorities 19 29 1
70951 \N \N 36047042800 Low income, mix of minorities 19 29 1
70952 \N \N 36047043000 Low income, mix of minorities 19 29 1
70953 \N \N 36047043200 Low income, mix of minorities 19 29 1
70954 \N \N 36047043400 Low income, mix of minorities 19 29 1
70955 \N \N 36047043600 Low income, mix of minorities 19 29 1
70956 \N \N 36047043800 Low income, mix of minorities 19 29 1
70957 \N \N 36047044000 Low income, mix of minorities 19 29 1
70958 \N \N 36047044200 Low income, mix of minorities 19 29 1
70959 \N \N 36047009200 Low income, mix of minorities 19 29 1
70960 \N \N 36047009400 Low income, mix of minorities 19 29 1
70961 \N \N 36047010000 Low income, mix of minorities 19 29 1
70962 \N \N 36047010200 Low income, mix of minorities 19 29 1
70963 \N \N 36047010400 Low income, mix of minorities 19 29 1
70964 \N \N 36047010600 Low income, mix of minorities 19 29 1
70965 \N \N 36047010800 Low income, mix of minorities 19 29 1
70966 \N \N 36047011000 Low income, mix of minorities 19 29 1
70967 \N \N 36047011200 Low income, mix of minorities 22 33 1
70968 \N \N 36047011400 Low income, mix of minorities 19 29 1
70969 \N \N 36047011600 Low income, mix of minorities 19 29 1
70970 \N \N 36047011800 Low income, mix of minorities 19 29 1
70971 \N \N 36047012000 Low income, mix of minorities 19 29 1
70972 \N \N 36047012700 Low income, mix of minorities 22 33 1
70973 \N \N 36047012801 Low income, mix of minorities 19 29 1
70974 \N \N 36047013000 Low income, mix of minorities 19 29 1
70976 \N \N 36047050400 Low income, mix of minorities 22 33 1
70977 \N \N 36047050500 Low income, mix of minorities 22 33 1
70978 \N \N 36047050600 Low income, mix of minorities 22 33 1
70979 \N \N 36047051100 Low income, mix of minorities 22 33 1
70980 \N \N 36047051200 Low income, mix of minorities 22 33 1
70981 \N \N 36047051400 Low income, mix of minorities 22 33 1
70982 \N \N 36047051800 Low income, mix of minorities 22 33 1
70983 \N \N 36047052000 Low income, mix of minorities 19 29 1
70984 \N \N 36047052300 Low income, mix of minorities 22 33 1
70985 \N \N 36047052500 Low income, mix of minorities 22 33 1
70986 \N \N 36047052600 Low income, mix of minorities 22 33 1
70987 \N \N 36047052700 Low income, mix of minorities 22 33 1
70988 \N \N 36047052800 Low income, mix of minorities 19 29 1
70989 \N \N 36047053000 Low income, mix of minorities 19 29 1
70990 \N \N 36047053200 Low income, mix of minorities 19 29 1
70991 \N \N 36047044400 Low income, mix of minorities 19 29 1
70992 \N \N 36047044600 Low income, mix of minorities 19 29 1
70993 \N \N 36047044800 Low income, mix of minorities 19 29 1
70994 \N \N 36047045200 Low income, mix of minorities 19 29 1
70995 \N \N 36047045400 Low income, mix of minorities 19 29 1
70996 \N \N 36047045600 Low income, mix of minorities 19 29 1
70997 \N \N 36047045800 Low income, mix of minorities 19 29 1
70998 \N \N 36047046202 Low income, mix of minorities 19 29 1
70999 \N \N 36047048000 Low income, mix of minorities 19 29 1
71000 \N \N 36047048200 Low income, mix of minorities 22 33 1
71001 \N \N 36047048400 Low income, mix of minorities 19 29 1
71002 \N \N 36047013200 Low income, mix of minorities 19 29 1
71003 \N \N 36047013400 Low income, mix of minorities 19 29 1
71004 \N \N 36047013600 Low income, mix of minorities 19 29 1
71005 \N \N 36047013800 Low income, mix of minorities 19 29 1
71006 \N \N 36047014000 Low income, mix of minorities 19 29 1
71007 \N \N 36047014200 Low income, mix of minorities 19 29 1
71008 \N \N 36047014800 Low income, mix of minorities 19 29 1
71009 \N \N 36047015000 Low income, mix of minorities 19 29 1
71010 \N \N 36047016000 Low income, mix of minorities 19 29 1
71011 \N \N 36047016200 Low income, mix of minorities 19 29 1
71012 \N \N 36047027800 Low income, mix of minorities 19 29 1
71013 \N \N 36047027900 Low income, mix of minorities 27 41 1
71014 \N \N 36047028000 Low income, mix of minorities 19 29 1
71015 \N \N 36047028100 Low income, mix of minorities 22 33 1
71016 \N \N 36047082000 Low income, mix of minorities 22 33 1
71017 \N \N 36047082200 Low income, mix of minorities 22 33 1
71018 \N \N 36047082400 Low income, mix of minorities 27 41 1
71019 \N \N 36047082600 Low income, mix of minorities 27 41 1
71020 \N \N 36047082800 Low income, mix of minorities 27 41 1
71021 \N \N 36047083000 Low income, mix of minorities 27 41 1
71022 \N \N 36047083200 Low income, mix of minorities 27 41 1
71023 \N \N 36047083400 Low income, mix of minorities 27 41 1
71024 \N \N 36047083600 Low income, mix of minorities 27 41 1
71025 \N \N 36047083800 Low income, mix of minorities 27 41 1
71026 \N \N 36047084000 Low income, mix of minorities 27 41 1
71027 \N \N 36047084600 Low income, mix of minorities 27 41 1
71028 \N \N 36047084800 Low income, mix of minorities 27 41 1
71029 \N \N 36047085000 Low income, mix of minorities 27 41 1
71030 \N \N 36047085400 Low income, mix of minorities 27 41 1
71031 \N \N 36047085600 Low income, mix of minorities 27 41 1
71032 \N \N 36047085800 Low income, mix of minorities 27 41 1
71033 \N \N 36047086000 Low income, mix of minorities 27 41 1
71034 \N \N 36047086200 Low income, mix of minorities 27 41 1
71035 \N \N 36047086400 Low income, mix of minorities 27 41 1
71036 \N \N 36047086600 Low income, mix of minorities 27 41 1
71037 \N \N 36047086800 Low income, mix of minorities 27 41 1
71038 \N \N 36047118201 Low income, mix of minorities 19 29 1
71039 \N \N 36047118202 Low income, mix of minorities 19 29 1
71040 \N \N 36047118400 Low income, mix of minorities 19 29 1
71041 \N \N 36047118600 Low income, mix of minorities 19 29 1
71042 \N \N 36047118800 Low income, mix of minorities 19 29 1
71043 \N \N 36047119200 Low income, mix of minorities 27 41 1
71044 \N \N 36047119400 Low income, mix of minorities 27 41 1
71045 \N \N 36047119600 Low income, mix of minorities 27 41 1
71046 \N \N 36047120000 Low income, mix of minorities 19 29 1
71047 \N \N 36047120800 Low income, mix of minorities 27 41 1
71048 \N \N 36047122000 Low income, mix of minorities 27 41 1
71049 \N \N 36047054600 Low income, mix of minorities 19 29 1
71050 \N \N 36047120200 Low income, mix of minorities 19 29 1
71051 \N \N 36047072600 Low income, mix of minorities 27 41 1
71052 \N \N 36047067200 Low income, mix of minorities 27 41 1
71053 \N \N 36047067400 Low income, mix of minorities 27 41 1
71054 \N \N 36047067600 Low income, mix of minorities 27 41 1
71055 \N \N 36047067800 Low income, mix of minorities 27 41 1
71056 \N \N 36047051002 Low income, mix of minorities 22 33 1
71057 \N \N 36047051602 Low income, mix of minorities 22 33 1
71058 \N \N 36047061003 Low income, mix of minorities 19 29 1
71059 \N \N 36047069601 Low income, mix of minorities 19 29 1
71060 \N \N 36047069602 Low income, mix of minorities 19 29 1
71061 \N \N 36047079601 Low income, mix of minorities 22 33 1
71062 \N \N 36047079602 Low income, mix of minorities 22 33 1
71063 \N \N 36047079801 Low income, mix of minorities 22 33 1
71064 \N \N 36047079802 Low income, mix of minorities 22 33 1
71065 \N \N 36047016800 Low income, mix of minorities 19 29 1
71066 \N \N 36047017000 Low income, mix of minorities 19 29 1
71067 \N \N 36047017200 Low income, mix of minorities 19 29 1
71068 \N \N 36047017400 Low income, mix of minorities 19 29 1
71069 \N \N 36047017600 Low income, mix of minorities 19 29 1
71070 \N \N 36047017800 Low income, mix of minorities 19 29 1
71071 \N \N 36047017900 Low income, mix of minorities 22 33 1
71072 \N \N 36047018000 Low income, mix of minorities 19 29 1
71073 \N \N 36047018200 Low income, mix of minorities 19 29 1
71074 \N \N 36047018400 Low income, mix of minorities 19 29 1
71075 \N \N 36047018501 Low income, mix of minorities 22 33 1
71076 \N \N 36047018600 Low income, mix of minorities 19 29 1
71077 \N \N 36047087000 Low income, mix of minorities 27 41 1
71078 \N \N 36047087200 Low income, mix of minorities 27 41 1
71079 \N \N 36047087401 Low income, mix of minorities 27 41 1
71080 \N \N 36047087600 Low income, mix of minorities 27 41 1
71081 \N \N 36047087800 Low income, mix of minorities 27 41 1
71082 \N \N 36047088000 Low income, mix of minorities 27 41 1
71083 \N \N 36047088200 Low income, mix of minorities 27 41 1
71084 \N \N 36047088400 Low income, mix of minorities 27 41 1
71085 \N \N 36047088600 Low income, mix of minorities 27 41 1
71086 \N \N 36047088800 Low income, mix of minorities 27 41 1
71087 \N \N 36047089000 Low income, mix of minorities 27 41 1
71088 \N \N 36047089200 Low income, mix of minorities 27 41 1
71089 \N \N 36047089400 Low income, mix of minorities 27 41 1
71090 \N \N 36047089600 Low income, mix of minorities 27 41 1
71091 \N \N 36047089800 Low income, mix of minorities 27 41 1
71092 \N \N 36047090000 Low income, mix of minorities 27 41 1
71093 \N \N 36047090200 Low income, mix of minorities 22 33 1
71094 \N \N 36047091000 Low income, mix of minorities 27 41 1
71095 \N \N 36047091600 Low income, mix of minorities 27 41 1
71096 \N \N 36047091800 Low income, mix of minorities 22 33 1
71097 \N \N 36047092000 Low income, mix of minorities 27 41 1
71098 \N \N 36047092200 Low income, mix of minorities 27 41 1
71099 \N \N 36047092800 Low income, mix of minorities 27 41 1
71100 \N \N 36047068000 Low income, mix of minorities 27 41 1
71101 \N \N 36047068200 Low income, mix of minorities 27 41 1
71102 \N \N 36047068600 Low income, mix of minorities 19 29 1
71103 \N \N 36047068800 Low income, mix of minorities 27 41 1
71104 \N \N 36047069000 Low income, mix of minorities 27 41 1
71105 \N \N 36047069200 Low income, mix of minorities 27 41 1
71106 \N \N 36047069800 Low income, mix of minorities 19 29 1
71107 \N \N 36047070000 Low income, mix of minorities 19 29 1
71108 \N \N 36047070201 Low income, mix of minorities 19 29 1
71109 \N \N 36047070600 Low income, mix of minorities 19 29 1
71110 \N \N 36047072000 Low income, mix of minorities 27 41 1
71111 \N \N 36047072200 Low income, mix of minorities 27 41 1
71112 \N \N 36047072400 Low income, mix of minorities 27 41 1
71113 \N \N 36047073000 Low income, mix of minorities 27 41 1
71114 \N \N 36047073200 Low income, mix of minorities 27 41 1
71115 \N \N 36047073400 Low income, mix of minorities 27 41 1
71116 \N \N 36047073600 Low income, mix of minorities 27 41 1
71117 \N \N 36047073800 Low income, mix of minorities 19 29 1
71118 \N \N 36047074000 Low income, mix of minorities 19 29 1
71119 \N \N 36047074200 Low income, mix of minorities 19 29 1
71120 \N \N 36047074400 Low income, mix of minorities 19 29 1
\.
CREATE SCHEMA IF NOT EXISTS observatory;
ALTER TABLE obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d SET SCHEMA observatory;
ALTER TABLE obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d SET SCHEMA observatory;

File diff suppressed because one or more lines are too long

View File

@@ -87,7 +87,7 @@ SELECT
cdb_observatory._TestPoint(),
'obs_a92e1111ad3177676471d66bb8036e6d057f271b'::text, -- see example in obs_geomtable
(Array['{"colname":"total_pop","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":"sum","name":"Total Population","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'::json])
))[1]::text = '{"value":4809.33511352425,"name":"Total Population","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
))[1]::text = '{"value":4809.07989821893,"name":"Total Population","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
as OBS_GetPoints_for_test_point;
-- what happens at null island
@@ -109,7 +109,7 @@ SELECT
cdb_observatory._TestArea(),
'obs_a92e1111ad3177676471d66bb8036e6d057f271b'::text, -- see example in obs_geomtable
Array['{"colname":"total_pop","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":"sum","name":"Total Population","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'::json]
))[1]::text = '{"value":1570.72353789469,"name":"Total Population","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
))[1]::text = '{"value":1570.78845496678,"name":"Total Population","tablename":"obs_ab038198aaab3f3cb055758638ee4de28ad70146","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
as OBS_GetPolygons_for_test_point;
-- see what happens around null island

View File

@@ -112,4 +112,219 @@ SELECT cdb_observatory.OBS_GetBoundaryById(
'"us.census.tiger".census_tract'
) IS NULL As OBS_GetBoundaryById_boundary_id_mismatch_geom_id;
-- _OBS_GetBoundariesByGeometry
-- check that all census tracts intersecting with the geometry are returned
-- order them to ensure that the same values are returned
SELECT
array_agg(geom_refs) = Array['36047025700','36047028501','36047038900','36047039100','36047042300','36047042500','36047042700','36047044900','36047045300','36047048500','36047048900','36047049100','36047049300','36047050500','36047050700'] As _OBS_GetBoundariesByGeometry_tracts_around_cartodb
FROM (
SELECT *
FROM cdb_observatory._OBS_GetBoundariesByGeometry(
-- near CartoDB's office
ST_MakeEnvelope(-73.9452409744,40.6988851644,-73.9280319214,40.7101254524,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- Null Island area
SELECT
array_length(array_agg(geom_refs), 1) IS NULL As _OBS_GetBoundariesByGeometry_tracts_around_null_island
FROM (
SELECT *
FROM cdb_observatory._OBS_GetBoundariesByGeometry(
-- around null island
ST_MakeEnvelope(-0.1400756836,-0.2114863362,0.1455688477,0.2059932086,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- OBS_GetBoundariesByGeometry
-- check that all census tracts intersecting with the geometry are returned
-- order them to ensure that the same values are returned
SELECT
array_agg(geom_refs) = Array['36047025700','36047028501','36047038900','36047039100','36047042300','36047042500','36047042700','36047044900','36047045300','36047048500','36047048900','36047049100','36047049300','36047050500','36047050700'] As OBS_GetBoundariesByGeometry_tracts_around_cartodb
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByGeometry(
-- near CartoDB's office
ST_MakeEnvelope(-73.9452409744,40.6988851644,-73.9280319214,40.7101254524,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- Null Island area
SELECT
array_length(array_agg(geom_refs), 1) IS NULL As OBS_GetBoundariesByGeometry_tracts_around_null_island
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByGeometry(
-- around null island
ST_MakeEnvelope(-0.1400756836,-0.2114863362,0.1455688477,0.2059932086,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- OBS_GetBoundariesByPointAndRadius
-- check that all census tracts intersecting with the geometry are returned
-- order them to ensure that the same values are returned
SELECT
array_agg(geom_refs) = Array['36047038900','36047039100','36047042500','36047042700','36047045300','36047048500','36047048900','36047049100','36047049300'] As OBS_GetBoundariesByPointAndRadius_around_cartodb
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByPointAndRadius(
-- 500 meter circle centered on CartoDB's office
cdb_observatory._testPoint(),
500,
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- Null Island area
SELECT
array_length(array_agg(geom_refs), 1) IS NULL As OBS_GetBoundariesByPointAndRadius_around_null_island
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByPointAndRadius(
-- around null island
ST_SetSRID(ST_Point(0, 0), 4326),
500,
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- _OBS_GetPointsByGeometry
-- check that all census tracts intersecting with the geometry are returned
-- order them to ensure that the same values are returned
SELECT
array_agg(geom_refs) = Array['36047025700','36047028501','36047038900','36047039100','36047042300','36047042500','36047042700','36047044900','36047045300','36047048500','36047048900','36047049100','36047049300','36047050500','36047050700'] As _OBS_GetPointsByGeometry_around_cartodb
FROM (
SELECT *
FROM cdb_observatory._OBS_GetPointsByGeometry(
-- around CartoDB's Brooklyn office
ST_MakeEnvelope(-73.9452409744,40.6988851644,
-73.9280319214,40.7101254524,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- Null Island area
SELECT
array_length(array_agg(geom_refs), 1) IS NULL As _OBS_GetPointsByGeometry_around_null_island
FROM (
SELECT *
FROM cdb_observatory._OBS_GetPointsByGeometry(
-- around null island
ST_MakeEnvelope(-0.1400756836,-0.2114863362,
0.1455688477, 0.2059932086,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- OBS_GetPointsByGeometry
-- check that all census tracts intersecting with the geometry are returned
-- order them to ensure that the same values are returned
SELECT
array_agg(geom_refs) = Array['36047025700','36047028501','36047038900','36047039100','36047042300','36047042500','36047042700','36047044900','36047045300','36047048500','36047048900','36047049100','36047049300','36047050500','36047050700'] As OBS_GetPointsByGeometry_around_cartodb
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByGeometry(
-- around CartoDB's Brooklyn office
ST_MakeEnvelope(-73.9452409744,40.6988851644,
-73.9280319214,40.7101254524,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
SELECT
array_agg(geom_refs) = Array['36047025700','36047028501','36047038900','36047039100','36047042300','36047042500','36047042700','36047044900','36047045300','36047048500','36047048900','36047049100','36047049300','36047050500','36047050700'] As OBS_GetPointsByGeometry_around_cartodb_2013
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByGeometry(
-- around CartoDB's Brooklyn office
ST_MakeEnvelope(-73.9452409744,40.6988851644,
-73.9280319214,40.7101254524,
4326),
'"us.census.tiger".census_tract',
'2013')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- Null Island area
SELECT
array_length(array_agg(geom_refs), 1) IS NULL As OBS_GetPointsByGeometry_around_null_island
FROM (
SELECT *
FROM cdb_observatory.OBS_GetBoundariesByGeometry(
-- around null island
ST_MakeEnvelope(-0.1400756836,-0.2114863362,
0.1455688477, 0.2059932086,
4326),
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- OBS_GetPointsByPointAndRadius
-- check that all census tracts intersecting with the geometry are returned
-- order them to ensure that the same values are returned
SELECT
array_agg(geom_refs) = Array['36047038900','36047039100','36047042500','36047042700','36047045300','36047048500','36047048900','36047049100','36047049300'] As OBS_GetPointsByPointAndRadius_around_cartodb
FROM (
SELECT *
FROM cdb_observatory.OBS_GetPointsByPointAndRadius(
-- around CartoDB's Brooklyn office
cdb_observatory._testpoint(),
500,
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
SELECT
array_agg(geom_refs) = Array['36047038900','36047039100','36047042500','36047042700','36047045300','36047048500','36047048900','36047049100','36047049300'] As OBS_GetPointsByPointAndRadius_around_cartodb_2013
FROM (
SELECT *
FROM cdb_observatory.OBS_GetPointsByPointAndRadius(
-- around CartoDB's Brooklyn office
cdb_observatory._testpoint(),
500,
'"us.census.tiger".census_tract',
'2013')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- Null Island area
SELECT
array_length(array_agg(geom_refs), 1) IS NULL As OBS_GetPointsByPointAndRadius_around_null_island
FROM (
SELECT *
FROM cdb_observatory.OBS_GetPointsByPointAndRadius(
-- around null island
ST_SetSRID(ST_Point(0, 0), 4326),
500,
'"us.census.tiger".census_tract')
ORDER BY geom_refs ASC
) As m(the_geom, geom_refs);
-- _OBS_GetGeometryMetadata
SELECT
geoid_colname = 'geoid' As geoid_name_matches,
target_table = 'obs_a92e1111ad3177676471d66bb8036e6d057f271b' As table_name_matches,
geom_colname = 'the_geom' As geom_name_matches
FROM cdb_observatory._OBS_GetGeometryMetadata('"us.census.tiger".census_tract')
As m(geoid_colname, target_table, geom_colname);
\i test/sql/drop_fixtures.sql