diff --git a/src/pg/test/expected/41_observatory_augmentation_test.out b/src/pg/test/expected/41_observatory_augmentation_test.out index e561c75..7d759df 100644 --- a/src/pg/test/expected/41_observatory_augmentation_test.out +++ b/src/pg/test/expected/41_observatory_augmentation_test.out @@ -56,9 +56,19 @@ Done. {gini_index} | {0.3494} (1 row) + names | vals +--------------+------ + {gini_index} | {} +(1 row) + obs_getpoints -------------------- {4809.33380072727} +(1 row) + + obs_getpoints +--------------- + (1 row) obs_getpolygons @@ -66,16 +76,31 @@ Done. {1570.72353789469} (1 row) + obs_getpolygons +----------------- + {NULL} +(1 row) + segment_name | total_pop_quantile | male_pop_quantile | female_pop_quantile | median_age_quantile | white_pop_quantile | black_pop_quantile | asian_pop_quantile | hispanic_pop_quantile | not_us_citizen_pop_quantile | workers_16_and_over_quantile | commuters_by_car_truck_van_quantile | commuters_by_public_transportation_quantile | commuters_by_bus_quantile | commuters_by_subway_or_elevated_quantile | walked_to_work_quantile | worked_at_home_quantile | children_quantile | households_quantile | population_3_years_over_quantile | in_school_quantile | in_grades_1_to_4_quantile | in_grades_5_to_8_quantile | in_grades_9_to_12_quantile | in_undergrad_college_quantile | pop_25_years_over_quantile | high_school_diploma_quantile | bachelors_degree_quantile | masters_degree_quantile | pop_5_years_over_quantile | speak_only_english_at_home_quantile | speak_spanish_at_home_quantile | pop_determined_poverty_status_quantile | poverty_quantile | median_income_quantile | gini_index_quantile | income_per_capita_quantile | housing_units_quantile | vacant_housing_units_quantile | vacant_housing_units_for_rent_quantile | vacant_housing_units_for_sale_quantile | median_rent_quantile | percent_income_spent_on_rent_quantile | owner_occupied_housing_units_quantile | million_dollar_housing_units_quantile -----------------------------+--------------------+-------------------+---------------------+---------------------+--------------------+--------------------+--------------------+-----------------------+-----------------------------+------------------------------+-------------------------------------+---------------------------------------------+---------------------------+------------------------------------------+-------------------------+-------------------------+--------------------+---------------------+----------------------------------+--------------------+---------------------------+---------------------------+----------------------------+-------------------------------+----------------------------+------------------------------+---------------------------+-------------------------+---------------------------+-------------------------------------+--------------------------------+----------------------------------------+-------------------+------------------------+---------------------+----------------------------+------------------------+-------------------------------+----------------------------------------+----------------------------------------+----------------------+---------------------------------------+---------------------------------------+--------------------------------------- Wealthy, urban without Kids | 0.234783783783784 | 0.422405405405405 | 0.0987567567567568 | 0.0715 | 0.295310810810811 | 0.407189189189189 | 0.625608108108108 | 0.795202702702703 | 0.703797297297297 | 0.59227027027027 | 0.0180540540540541 | 0.993756756756757 | 0.728162162162162 | 0.995972972972973 | 0.929135135135135 | 0.625432432432432 | 0.0386081081081081 | 0.157121621621622 | 0.241878378378378 | 0.173783783783784 | 0.0380675675675676 | 0.0308108108108108 | 0.0486216216216216 | 0.479743243243243 | 0.297675675675676 | 0.190351351351351 | 0.802513513513514 | 0.757148648648649 | 0.255405405405405 | 0.196094594594595 | 0.816851351351351 | 0.252513513513514 | 0.560054054054054 | 0.777472972972973 | 0.336932432432432 | 0.655378378378378 | 0.141810810810811 | 0.362824324324324 | 0.463837837837838 | 0 | 0.939040540540541 | 0.419445945945946 | 0.0387972972972973 | 0 (1 row) + segment_name | total_pop_quantile | male_pop_quantile | female_pop_quantile | median_age_quantile | white_pop_quantile | black_pop_quantile | asian_pop_quantile | hispanic_pop_quantile | not_us_citizen_pop_quantile | workers_16_and_over_quantile | commuters_by_car_truck_van_quantile | commuters_by_public_transportation_quantile | commuters_by_bus_quantile | commuters_by_subway_or_elevated_quantile | walked_to_work_quantile | worked_at_home_quantile | children_quantile | households_quantile | population_3_years_over_quantile | in_school_quantile | in_grades_1_to_4_quantile | in_grades_5_to_8_quantile | in_grades_9_to_12_quantile | in_undergrad_college_quantile | pop_25_years_over_quantile | high_school_diploma_quantile | bachelors_degree_quantile | masters_degree_quantile | pop_5_years_over_quantile | speak_only_english_at_home_quantile | speak_spanish_at_home_quantile | pop_determined_poverty_status_quantile | poverty_quantile | median_income_quantile | gini_index_quantile | income_per_capita_quantile | housing_units_quantile | vacant_housing_units_quantile | vacant_housing_units_for_rent_quantile | vacant_housing_units_for_sale_quantile | median_rent_quantile | percent_income_spent_on_rent_quantile | owner_occupied_housing_units_quantile | million_dollar_housing_units_quantile +--------------+--------------------+-------------------+---------------------+---------------------+--------------------+--------------------+--------------------+-----------------------+-----------------------------+------------------------------+-------------------------------------+---------------------------------------------+---------------------------+------------------------------------------+-------------------------+-------------------------+-------------------+---------------------+----------------------------------+--------------------+---------------------------+---------------------------+----------------------------+-------------------------------+----------------------------+------------------------------+---------------------------+-------------------------+---------------------------+-------------------------------------+--------------------------------+----------------------------------------+------------------+------------------------+---------------------+----------------------------+------------------------+-------------------------------+----------------------------------------+----------------------------------------+----------------------+---------------------------------------+---------------------------------------+--------------------------------------- + | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +(1 row) + names | categories -----------+--------------------------------------------------------------- {X10,x10} | {"Wealthy, urban without Kids","Wealthy, urban without Kids"} (1 row) + names | categories +-----------+------------ + {X10,x10} | +(1 row) + Dropping obs_table.sql fixture table... Done. Dropping obs_column.sql fixture table... diff --git a/src/pg/test/sql/41_observatory_augmentation_test.sql b/src/pg/test/sql/41_observatory_augmentation_test.sql index 77ad9fb..bf8f0cb 100644 --- a/src/pg/test/sql/41_observatory_augmentation_test.sql +++ b/src/pg/test/sql/41_observatory_augmentation_test.sql @@ -56,6 +56,15 @@ SELECT * FROM '"us.census.tiger".block_group' ); +-- gini index at null island +SELECT * FROM + cdb_observatory.OBS_Get( + CDB_LatLng(0, 0), + Array['"us.census.acs".B19083001']::text[], + '2009 - 2013', + '"us.census.tiger".block_group' + ); + -- OBS_GetPoints -- obs_getpoints -- -------------------- @@ -68,6 +77,14 @@ SELECT Array[('total_pop','obs_ab038198aaab3f3cb055758638ee4de28ad70146','sum')::cdb_observatory.OBS_ColumnData] ); +-- what happens at null island +SELECT + cdb_observatory.OBS_GetPoints( + CDB_LatLng(0, 0), + 'obs_a92e1111ad3177676471d66bb8036e6d057f271b'::text, -- see example in obs_geomtable + Array[('total_pop','obs_ab038198aaab3f3cb055758638ee4de28ad70146','sum')::cdb_observatory.OBS_ColumnData] + ); + -- OBS_GetPolygons -- obs_getpolygons -- -------------------- @@ -80,12 +97,27 @@ SELECT Array[('total_pop','obs_ab038198aaab3f3cb055758638ee4de28ad70146','sum')::OBS_ColumnData] ); +-- see what happens around null island +SELECT + OBS_GetPolygons( + ST_Buffer(CDB_LatLng(0, 0)::geography, 500)::geometry, + 'obs_a92e1111ad3177676471d66bb8036e6d057f271b'::text, -- see example in obs_geomtable + Array[('total_pop','obs_ab038198aaab3f3cb055758638ee4de28ad70146','sum')::OBS_ColumnData] +); + SELECT * FROM cdb_observatory.OBS_GetSegmentSnapshot( _TestPoint(), '"us.census.tiger".census_tract' ); +-- segmentation around null island +SELECT * FROM + cdb_observatory.OBS_GetSegmentSnapshot( + CDB_LatLng(0, 0), + '"us.census.tiger".census_tract' +); + SELECT * FROM cdb_observatory.OBS_GetCategories( _TestPoint(), @@ -93,4 +125,11 @@ SELECT * FROM '"us.census.tiger".census_tract' ); +SELECT * FROM + cdb_observatory.OBS_GetCategories( + CDB_LatLng(0, 0), + Array['"us.census.spielman_singleton_segments".X10'], + '"us.census.tiger".census_tract' +); + \i test/sql/drop_fixtures.sql