Commit 85dc0483 authored by Markus Wanner's avatar Markus Wanner

Import upstream version 2.1.0

parent 4eb6b621
This diff is collapsed.
PostGIS 2.1.0
2013/07/DD
2013/08/17
* Important / Breaking Changes *
- #1962 ST_Segmentize - As a result of the introduction of geography support:
The construct SELECT ST_Segmentize('LINESTRING(1 2, 3 4)',0.5);
will result in ambiguous function error
- #2089, liblwgeom: lwgeom_set_handlers replaces lwgeom_init_allocators.
- #1653, Removed srid parameter from ST_Resample(raster) and variants
with reference raster no longer apply reference raster's SRID.
- #1962 ST_Segmentize - As a result of
the introduction of geography support, The construct:
SELECT ST_Segmentize('LINESTRING(1 2, 3 4)',0.5);
will result in ambiguous function error
- #2026, ST_Union(raster) now unions all bands of all rasters
- #2089, liblwgeom: lwgeom_set_handlers replaces lwgeom_init_allocators.
- #2150, regular_blocking is no longer a constraint. column of same name
in raster_columns now checks for existance of spatially_unique
and coverage_tile constraints
......@@ -40,8 +40,13 @@ PostGIS 2.1.0
Use expression variants of ST_MapAlgebra instead
* New Features *
- Refer to http://postgis.net/docs/manual-2.1/PostGIS_Special_Functions_Index.html#NewFunctions_2_1
for complete list of new functions
- #310, ST_DumpPoints converted to a C function (Nathan Wagner)
- #739, UpdateRasterSRID()
- #945, improved join selectivity, N-D selectivity calculations,
user accessible selectivity and stats reader functions for
testing (Paul Ramsey / OpenGeo)
- toTopoGeom with TopoGeometry sink (Sandro Santilli / Vizzuality)
- clearTopoGeom (Sandro Santilli / Vizzuality)
- ST_Segmentize(geography) (Paul Ramsey / OpenGeo)
......@@ -56,28 +61,27 @@ PostGIS 2.1.0
(Bborie Park / UC Davis)
- Added array variants of ST_SetValues() to set many pixel values of a band
in one call (Bborie Park / UC Davis)
- #1293, ST_Resize(raster) to resize rasters based upon width/height
- #1627, package tiger_geocoder as a PostgreSQL extension
- #1643, #2076, Upgrade tiger geocoder to support loading tiger 2011 and 2012
(Regina Obe / Paragon Corporation) Funded by Hunter Systems Group
- GEOMETRYCOLLECTION support for ST_MakeValid (Sandro Santilli / Vizzuality)
- #1709, ST_NotSameAlignmentReason(raster, raster)
- #1818, ST_GeomFromGeoHash and friends (Jason Smith (darkpanda))
- #1856, reverse geocoder rating setting for prefer numbered highway name
- ST_PixelOfValue (Bborie Park / UC Davis)
- Casts to/from PostgreSQL geotypes (point/path/polygon).
- #2011, ST_DumpValues to output raster as array (Bborie Park / UC Davis)
- #2018, ST_Distance support for CircularString, CurvePolygon, MultiCurve,
MultiSurface, CompoundCurve
- #2030, n-raster (and n-band) ST_MapAlgebra (Bborie Park / UC Davis)
- Added geomval array variant of ST_SetValues() to set many pixel values of
a band using a set of geometries and corresponding values in one call
(Bborie Park / UC Davis)
- ST_Tile(raster) to break up a raster into tiles (Bborie Park / UC Davis)
- #739, UpdateRasterSRID()
- #1895, new r-tree node splitting algorithm (Alex Korotkov)
- #1709, ST_NotSameAlignmentReason(raster, raster)
- #1293, ST_Resize(raster) to resize rasters based upon width/height
- #945, improved join selectivity, N-D selectivity calculations,
user accessible selectivity and stats reader functions for
testing (Paul Ramsey / OpenGeo)
- #2011, ST_DumpValues to output raster as array (Bborie Park / UC Davis)
- #2018, ST_Distance support for CircularString, CurvePolygon, MultiCurve,
MultiSurface, CompoundCurve
- #2030, n-raster (and n-band) ST_MapAlgebra (Bborie Park / UC Davis)
- #2193, Utilize PAGC parser as drop in replacement for tiger normalizer
(Steve Woodbridge, Regina Obe)
- #2210, ST_MinConvexHull(raster)
- lwgeom_from_geojson in liblwgeom (Sandro Santilli / Vizzuality)
- #1687, ST_Simplify for TopoGeometry (Sandro Santilli / Vizzuality)
......@@ -116,6 +120,8 @@ PostGIS 2.1.0
- #1780, support ST_GeoHash for geography
- #1796, Big performance boost for distance calculations in geography
- #1802, improved function interruptibility.
- #1823, add parameter in ST_AsGML to use id column for GML 3 output
(become mandatory since GML 3.2.1)
- #1856, tiger geocoder: reverse geocoder rating setting for prefer
numbered highway name
- #1938, Refactor basic ST_AddBand to add multiple new bands in one call
......@@ -159,8 +165,6 @@ PostGIS 2.1.0
out-db bands
- #2222, add parameter OutAsIn to flag whether ST_AsBinary should
return out-db bands as in-db bands
- #1823, add parameter in ST_AsGML to use id column for GML 3 output
(become mandatory since GML 3.2.1)
* Fixes *
......
......@@ -2,7 +2,7 @@ PostGIS - Geographic Information Systems Extensions to PostgreSQL
=================================================================
:Version: 2.1.0
:Date: 2013-07-DD
:Date: 2013-08-17
:Website: http://postgis.net
This distribution contains a module which implements GIS simple features, ties
......@@ -46,7 +46,7 @@ this to work.
http://trac.osgeo.org/proj/
* GEOS (Required, Version 3.3.0 or higher
* GEOS (Required, Version 3.3.3 or higher
- 3.4+ is strongly recommended and needed for full features):
The GEOS library provides support for exact topological tests such as
......
......@@ -5,5 +5,5 @@
POSTGIS_MAJOR_VERSION=2
POSTGIS_MINOR_VERSION=1
POSTGIS_MICRO_VERSION=0rc2
POSTGIS_MICRO_VERSION=0
......@@ -25,7 +25,7 @@ translations = it_IT pt_BR
POSTGIS_MAJOR_VERSION=2
POSTGIS_MINOR_VERSION=1
POSTGIS_MICRO_VERSION=0rc2
POSTGIS_MICRO_VERSION=0
INSTALL=/usr/bin/install -c
INSTALL_DATA=${INSTALL} -m 644
......
......@@ -2113,10 +2113,13 @@ Returns a text summary of the contents of the geometry.
<listitem><para>Z: has Z ordinate</para></listitem>
<listitem><para>B: has a cached bounding box</para></listitem>
<listitem><para>G: is geodetic (geography)</para></listitem>
<listitem><para>S: has spatial reference system</para></listitem>
</itemizedlist>
</para>
<para>Availability: 1.2.2 - 2.0.0 added support for geography</para>
<para>Availability: 1.2.2</para>
<para>Enhanced: 2.0.0 added support for geography</para>
<para>Enhanced: 2.1.0 S flag to denote if has a known spatial reference system</para>
</refsection>
......@@ -2128,20 +2131,20 @@ Returns a text summary of the contents of the geometry.
ST_Summary(ST_GeogFromText('POLYGON((0 0, 1 1, 1 2, 1 1, 0 0))')) geog;
geom | geog
-----------------------------+--------------------------
LineString[B] with 2 points | Polygon[BG] with 1 rings
: ring 0 has 5 points
LineString[B] with 2 points | Polygon[BGS] with 1 rings
| ring 0 has 5 points
:
(1 row)
=# SELECT ST_Summary(ST_GeogFromText('LINESTRING(0 0 1, 1 1 1)')) As geog_line,
ST_Summary(ST_GeomFromText('POLYGON((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))')) As geom_poly;
ST_Summary(ST_GeomFromText('SRID=4326;POLYGON((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))')) As geom_poly;
;
geog_line | geom_poly
-------------------------------+--------------------------
LineString[ZBG] with 2 points | Polygon[ZB] with 1 rings
: ring 0 has 5 points
:
geog_line | geom_poly
-------------------------------- +--------------------------
LineString[ZBGS] with 2 points | Polygon[ZBS] with 1 rings
: ring 0 has 5 points
:
(1 row)
</programlisting>
......
This diff is collapsed.
include ../upgradeable_versions.mk
EXTENSION = postgis
EXTVERSION = 2.1.0rc2
EXTVERSION = 2.1.0
MINORVERSION = 2.1
GREP = /bin/grep
......
# postgis extension
comment = 'PostGIS geometry, geography, and raster spatial types and functions'
default_version = '2.1.0rc2'
default_version = '2.1.0'
module_pathname = '$libdir/postgis-2.1'
relocatable = true
......@@ -1167,4 +1167,4 @@ ALTER EXTENSION postgis ADD type valid_detail;
ALTER EXTENSION postgis ADD view geography_columns;
ALTER EXTENSION postgis ADD view geometry_columns;
ALTER EXTENSION postgis ADD view raster_columns;
ALTER EXTENSION postgis ADD view raster_overviews;
\ No newline at end of file
ALTER EXTENSION postgis ADD view raster_overviews;
include ../upgradeable_versions.mk
EXTENSION = postgis_tiger_geocoder
EXTVERSION = 2.1.0rc2
EXTVERSION = 2.1.0
MINORVERSION = 2011.2.1
MICRO_NUMBER = $(shell echo $(EXTVERSION) | sed "s/[0-9]\.[0-9]\.\([0-9]*\)[a-zA-Z]*[0-9]*/\1/")
......
# postgis tiger geocoder extension
comment = 'PostGIS tiger geocoder and reverse geocoder'
default_version = '2.1.0rc2'
default_version = '2.1.0'
relocatable = false
schema = tiger
requires = 'postgis,fuzzystrmatch'
......@@ -52,6 +52,7 @@ ALTER EXTENSION postgis_tiger_geocoder ADD function utmzone(geometry);
ALTER EXTENSION postgis_tiger_geocoder ADD function zip_range(text,integer,integer);
ALTER EXTENSION postgis_tiger_geocoder ADD sequence addr_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence addrfeat_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence bg_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence county_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence cousub_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence edges_gid_seq;
......@@ -62,9 +63,12 @@ ALTER EXTENSION postgis_tiger_geocoder ADD sequence pagc_lex_id_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence pagc_rules_id_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence place_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence state_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence tabblock_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence tract_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD sequence zcta5_gid_seq;
ALTER EXTENSION postgis_tiger_geocoder ADD table addr;
ALTER EXTENSION postgis_tiger_geocoder ADD table addrfeat;
ALTER EXTENSION postgis_tiger_geocoder ADD table bg;
ALTER EXTENSION postgis_tiger_geocoder ADD table county;
ALTER EXTENSION postgis_tiger_geocoder ADD table county_lookup;
ALTER EXTENSION postgis_tiger_geocoder ADD table countysub_lookup;
......@@ -86,10 +90,12 @@ ALTER EXTENSION postgis_tiger_geocoder ADD table secondary_unit_lookup;
ALTER EXTENSION postgis_tiger_geocoder ADD table state;
ALTER EXTENSION postgis_tiger_geocoder ADD table state_lookup;
ALTER EXTENSION postgis_tiger_geocoder ADD table street_type_lookup;
ALTER EXTENSION postgis_tiger_geocoder ADD table tabblock;
ALTER EXTENSION postgis_tiger_geocoder ADD table tract;
ALTER EXTENSION postgis_tiger_geocoder ADD table zcta5;
ALTER EXTENSION postgis_tiger_geocoder ADD table zip_lookup;
ALTER EXTENSION postgis_tiger_geocoder ADD table zip_lookup_all;
ALTER EXTENSION postgis_tiger_geocoder ADD table zip_lookup_base;
ALTER EXTENSION postgis_tiger_geocoder ADD table zip_state;
ALTER EXTENSION postgis_tiger_geocoder ADD table zip_state_loc;
ALTER EXTENSION postgis_tiger_geocoder ADD type norm_addy;
\ No newline at end of file
ALTER EXTENSION postgis_tiger_geocoder ADD type norm_addy;
include ../upgradeable_versions.mk
EXTENSION = postgis_topology
EXTVERSION = 2.1.0rc2
EXTVERSION = 2.1.0
MINORVERSION = 2.1
PGIS_MAJ_MIN=21
GREP=/bin/grep
......
# postgis topology extension
comment = 'PostGIS topology spatial types and functions'
default_version = '2.1.0rc2'
default_version = '2.1.0'
relocatable = false
schema = topology
requires = postgis
......@@ -4,6 +4,6 @@ UPGRADEABLE_VERSIONS = \
2.0.2 \
2.0.3 \
2.0.4 \
2.1.0beta3 \
2.1.0rc1dev \
2.1.0rc1 \
2.1.0rc2 \
2.1.0rc3
--$Id: census_loader.sql 10179 2012-08-13 21:45:39Z robe $
--$Id: census_loader.sql 11760 2013-08-10 06:25:55Z robe $
--
-- PostGIS - Spatial Types for PostgreSQL
-- http://www.postgis.org
......@@ -43,7 +43,7 @@ IF NOT EXISTS(SELECT table_name FROM information_schema.columns WHERE table_sche
CONSTRAINT enforce_geotype_geom CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL),
CONSTRAINT enforce_srid_geom CHECK (st_srid(the_geom) = 4269)
);
COMMENT ON TABLE tiger.tract IS 'census tracts - $Id: census_loader.sql 10179 2012-08-13 21:45:39Z robe $';
COMMENT ON TABLE tiger.tract IS 'census tracts - $Id: census_loader.sql 11760 2013-08-10 06:25:55Z robe $';
DROP TABLE IF EXISTS tiger.tabblock;
CREATE TABLE tabblock
......@@ -68,7 +68,7 @@ IF NOT EXISTS(SELECT table_name FROM information_schema.columns WHERE table_sche
CONSTRAINT enforce_geotype_geom CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL),
CONSTRAINT enforce_srid_geom CHECK (st_srid(the_geom) = 4269)
);
COMMENT ON TABLE tiger.tabblock IS 'census blocks - $Id: census_loader.sql 10179 2012-08-13 21:45:39Z robe $';
COMMENT ON TABLE tiger.tabblock IS 'census blocks - $Id: census_loader.sql 11760 2013-08-10 06:25:55Z robe $';
DROP TABLE IF EXISTS tiger.bg;
CREATE TABLE bg
......@@ -92,7 +92,7 @@ IF NOT EXISTS(SELECT table_name FROM information_schema.columns WHERE table_sche
CONSTRAINT enforce_srid_geom CHECK (st_srid(the_geom) = 4269)
);
COMMENT ON TABLE tiger.bg IS 'block groups';
RETURN 'Done creating census tract base tables - $Id: census_loader.sql 10179 2012-08-13 21:45:39Z robe $';
RETURN 'Done creating census tract base tables - $Id: census_loader.sql 11760 2013-08-10 06:25:55Z robe $';
END IF;
IF EXISTS(SELECT * FROM information_schema.columns WHERE table_schema = 'tiger' AND column_name = 'tabblock_id' AND table_name = 'tabblock' AND character_maximum_length < 16) THEN -- size of name and tabblock_id fields need to be increased
......@@ -183,3 +183,6 @@ VALUES(12, 'bg', 'bg', true,false, true,false, 'c',
${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"
${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);"
${psql} -c "vacuum analyze ${data_schema}.${state_abbrev}_${lookup_name};"', ARRAY['gid']);
SELECT create_census_base_tables();
-- Lookup tables used by pagc to standardize in format expected by tiger geocoder
--$Id: pagc_tables.sql 11722 2013-08-03 16:10:28Z robe $-
--$Id: pagc_tables.sql 11758 2013-08-10 06:14:34Z robe $-
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT tiger.SetSearchPathForInstall('tiger');
......@@ -40,7 +40,7 @@ language plpgsql;
SELECT install_pagc_tables();
DELETE FROM pagc_gaz WHERE is_custom = false;
DELETE FROM pagc_lex WHERE is_custom = false;
DELETE FROM pagc_rules WHERE is_custom = false;
DELETE FROM pagc_rules WHERE is_custom = false OR id < 10000;
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (1, 1, 'AB', 'ALBERTA', 11, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (2, 2, 'AB', 'ALBERTA', 1, false);
......@@ -83,11 +83,11 @@ INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (64, 2, '
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (66, 2, 'CONN', 'CONNECTICUT', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (69, 2, 'CONNECTICUT', 'CONNECTICUT', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (71, 2, 'CT', 'CONNECTICUT', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (74, 2, 'DC', 'DISTRICT OF COLUMBIA', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (74, 2, 'DC', 'DC', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (77, 3, 'DE', 'DELAWARE', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (79, 2, 'DEL', 'DELAWARE', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (82, 2, 'DELAWARE', 'DELAWARE', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (84, 2, 'DISTRICT OF COLUMBIA', 'DISTRICT OF COLUMBIA', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (84, 2, 'DC', 'DISTRICT OF COLUMBIA', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (85, 2, 'EL PASO', 'EL PASO', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (87, 2, 'FL', 'FLORIDA', 1, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (90, 2, 'FLA', 'FLORIDA', 1, false);
......@@ -705,7 +705,7 @@ INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (76, 1, '
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (78, 1, 'DEL', 'DE', 11, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (80, 3, 'DEL', 'DE', 6, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (81, 1, 'DELAWARE', 'DE', 11, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (83, 1, 'DISTRICT OF COLUMBIA', 'DC', 11, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (83, 1, 'DC', 'DC', 11, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (86, 1, 'FL', 'FL', 11, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (88, 3, 'FL', 'FL', 6, false);
INSERT INTO pagc_gaz (id, seq, word, stdword, token, is_custom) VALUES (89, 1, 'FLA', 'FL', 11, false);
......@@ -3815,13 +3815,14 @@ INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2345, 2,
INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2353, 2, 'SQURE', 'SQ', 24, false);
INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2351, 2, 'SQUARE', 'SQ', 24, false);
INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2418, 2, 'STN', 'STA', 24, false);
INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2935, 2, 'NORTHWEST', 'NW', 22, false);
SELECT pg_catalog.setval('pagc_lex_id_seq', (SELECT greatest((SELECT MAX(id) FROM pagc_lex),50000)), true);
-- set default to false so all we input will be treated as no custom --
ALTER TABLE tiger.pagc_lex ALTER COLUMN is_custom SET DEFAULT false;
ALTER TABLE tiger.pagc_rules ALTER COLUMN is_custom SET DEFAULT false;
INSERT INTO pagc_rules (id, rule) VALUES (1, '1 -1 5 -1 2 7');
INSERT INTO pagc_rules (id, rule) VALUES (2, '1 3 -1 5 3 -1 2 7');
INSERT INTO pagc_rules (id, rule) VALUES (3, '1 22 -1 5 7 -1 2 7');
......@@ -8176,6 +8177,8 @@ INSERT INTO pagc_rules (id, rule) VALUES (4351, '1 2 11 28 29 12 -1 10 10 11 13
INSERT INTO pagc_rules (id, rule) values (4352, '16 0 22 -1 16 17 17 -1 4 7');
INSERT INTO pagc_rules (id, rule) VALUES (4355, '-1');
-- for some reason all rules are coming in as custom. just force by id
UPDATE tiger.pagc_rules SET is_custom = false where id < 10000;
-- after insert we need to set back to true so all
-- user inputs are treated as custom
ALTER TABLE tiger.pagc_rules ALTER COLUMN is_custom SET DEFAULT true;
......
--$Id: tiger_loader_2012.sql 11548 2013-06-20 06:24:56Z robe $
--$Id: tiger_loader_2012.sql 11750 2013-08-08 22:31:02Z robe $
--
-- PostGIS - Spatial Types for PostgreSQL
-- http://www.postgis.org
......@@ -76,8 +76,9 @@ set PSQL="%PGBIN%psql"
set SHP2PGSQL="%PGBIN%shp2pgsql"
cd ${staging_fold}
', E'del %TMPDIR%\\*.* /Q
%PSQL% -c "DROP SCHEMA ${staging_schema} CASCADE;"
%PSQL% -c "CREATE SCHEMA ${staging_schema};"
%PSQL% -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
%PSQL% -c "CREATE SCHEMA IF NOT EXISTS ${staging_schema};"
%PSQL% -c "CREATE SCHEMA IF NOT EXISTS ${data_schema};"
for /r %%z in (*.zip) do %UNZIPTOOL% e %%z -o%TMPDIR%
cd %TMPDIR%', E'%PSQL%', E'\\', E'%SHP2PGSQL%', 'set ',
'for /r %%z in (*${table_name}.dbf) do (${loader} -s 4269 -g the_geom -W "latin1" %%z tiger_staging.${state_abbrev}_${table_name} | ${psql} & ${psql} -c "SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}''));")'
......@@ -99,8 +100,9 @@ PSQL=${PGBIN}/psql
SHP2PGSQL=${PGBIN}/shp2pgsql
cd ${staging_fold}
', E'rm -f ${TMPDIR}/*.*
${PSQL} -c "DROP SCHEMA tiger_staging CASCADE;"
${PSQL} -c "CREATE SCHEMA tiger_staging;"
${PSQL} -c "DROP SCHEMA IF EXISTS ${staging_schema} CASCADE;"
${PSQL} -c "CREATE SCHEMA IF NOT EXISTS ${staging_schema};"
${PSQL} -c "CREATE SCHEMA IF NOT EXISTS ${data_schema};"
for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done
......
/**********************************************************************
* $Id: cu_libgeom.c 10661 2012-11-09 00:09:35Z pramsey $
* $Id: cu_libgeom.c 11738 2013-08-06 16:01:10Z robe $
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
......@@ -694,6 +694,7 @@ static void test_lwgeom_clone(void)
static void test_lwgeom_force_clockwise(void)
{
LWGEOM *geom;
LWGEOM *geom2;
char *in_ewkt, *out_ewkt;
/* counterclockwise, must be reversed */
......@@ -744,13 +745,14 @@ static void test_lwgeom_force_clockwise(void)
/* NOTE: this is a narrow ring, see ticket #1302 */
in_ewkt = "0103000000010000000500000000917E9BA468294100917E9B8AEA2841C976BE1FA4682941C976BE9F8AEA2841B39ABE1FA46829415ACCC29F8AEA284137894120A4682941C976BE9F8AEA284100917E9BA468294100917E9B8AEA2841";
geom = lwgeom_from_hexwkb(in_ewkt, LW_PARSER_CHECK_NONE);
lwgeom_force_clockwise(geom);
out_ewkt = lwgeom_to_hexwkb(geom, WKB_ISO, NULL);
if (strcmp(in_ewkt, out_ewkt))
fprintf(stderr, "\nExp: %s\nObt: %s\n", in_ewkt, out_ewkt);
CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
lwfree(out_ewkt);
geom2 = lwgeom_from_hexwkb(in_ewkt, LW_PARSER_CHECK_NONE);
lwgeom_force_clockwise(geom2);
/** use same check instead of strcmp to account
for difference in endianness **/
CU_ASSERT( lwgeom_same(geom, geom2) );
lwgeom_free(geom);
lwgeom_free(geom2);
}
/*
......
......@@ -361,34 +361,50 @@ static void test_ptarray_desegmentize()
lwfree(str);
*/
in = lwgeom_from_text("LINESTRING(-1 0, 0 1, 1 0, 0 -1)");
in = lwgeom_from_text("CIRCULARSTRING(-1 0,0 1,0 -1)");
out = lwgeom_segmentize(in,8);
lwgeom_free(in);
in = out;
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "CIRCULARSTRING(-1 0,0 1,0 -1)");
//printf("%s\n", str);
CU_ASSERT_STRING_EQUAL(str, "CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1)");
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
in = lwgeom_from_text("LINESTRING(-1 0, 0 1, 1 0, 0 -1, -1 -1)");
in = lwgeom_from_text("COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,-1 -1))");
out = lwgeom_segmentize(in,8);
lwgeom_free(in);
in = out;
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,-1 -1))");
//printf("%s\n", str);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),(0 -1,-1 -1))");
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
in = lwgeom_from_text("LINESTRING(-3 -3,-1 0, 0 1, 1 0, 0 -1, 0 -1.5, 0 -2, -1 -3, 0 -4, 1 -3,5 5)");
in = lwgeom_from_text("COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-1 -3,1 -3),(1 -3,5 5))");
out = lwgeom_segmentize(in,8);
lwgeom_free(in);
in = out;
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-1 -3,1 -3),(1 -3,5 5))");
//printf("%s\n", str);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-0.70710678 -3.7071068,1 -3),(1 -3,5 5))");
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
in = lwgeom_from_text("LINESTRING(-1 0, 0 1, 1 0, 0 -1, -1 -2, 0 -3, 1 -2)");
in = lwgeom_from_text("COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),CIRCULARSTRING(0 -1,-1 -2,1 -2))");
out = lwgeom_segmentize(in,8);
lwgeom_free(in);
in = out;
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),CIRCULARSTRING(0 -1,-1 -2,1 -2))");
//printf("%s\n", str);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),CIRCULARSTRING(0 -1,-0.70710678 -2.7071068,1 -2))");
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
......@@ -399,12 +415,49 @@ static void test_ptarray_desegmentize()
in = out;
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1,1 1),CIRCULARSTRING(1 1,1.8049097 1.9807853,3 1),(3 1,4 4))");
CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,2 2,3 1),(3 1,4 4))");
lwgeom_free(in);
lwgeom_free(out);
// printf("%s\n", str);
lwfree(str);
// See http://trac.osgeo.org/postgis/ticket/2425
// and http://trac.osgeo.org/postgis/ticket/2420
in = lwgeom_from_text("LINESTRING(0 0,10 0,10 10,0 10,0 0)");
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,10 0,10 10,0 10,0 0)");
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
in = lwgeom_from_text("LINESTRING(10 10,0 10,0 0,10 0)");
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "LINESTRING(10 10,0 10,0 0,10 0)");
printf("%s\n", str);
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
in = lwgeom_from_text("LINESTRING(0 0,10 0,10 10,0 10)");
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
CU_ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,10 0,10 10,0 10)");
printf("%s\n", str);
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
// See http://trac.osgeo.org/postgis/ticket/2412
in = lwgeom_from_text("LINESTRING(0 0, 1 1)");
out = lwgeom_desegmentize(in);
str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
//printf("%s\n", str);
CU_ASSERT_STRING_EQUAL(str, "LINESTRING(0 0,1 1)");
lwgeom_free(in);
lwgeom_free(out);
lwfree(str);
}
static void test_ptarray_contains_point()
......
......@@ -288,15 +288,6 @@ lwgeom_as_multi(const LWGEOM *lwgeom)
GBOX *box = NULL;
int type;
/*
** This funx is a no-op only if a bbox cache is already present
** in input.
*/
if ( lwgeom_is_collection(lwgeom) )
{
return lwgeom_clone(lwgeom);
}
type = lwgeom->type;
if ( ! MULTITYPE[type] ) return lwgeom_clone(lwgeom);
......
/**********************************************************************
* $Id: lwsegmentize.c 11400 2013-05-10 07:51:19Z strk $
* $Id: lwsegmentize.c 11802 2013-08-14 07:42:48Z strk $
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
......@@ -16,6 +16,9 @@
#include <string.h>
#include "liblwgeom_internal.h"
/* #define POSTGIS_DEBUG_LEVEL 4 */
#include "lwgeom_log.h"
......@@ -172,7 +175,8 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad)
pa = ptarray_construct_empty(1, 1, 32);
/* Sweep from a1 to a3 */
for ( angle = a1; clockwise ? angle > a3 : angle < a3; angle += increment )
ptarray_append_point(pa, p1, LW_FALSE);
for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment )
{
pt.x = center.x + radius * cos(angle);
pt.y = center.y + radius * sin(angle);
......@@ -220,7 +224,7 @@ lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad)
{
LWDEBUG(3, "lwcircstring_segmentize: points are colinear, returning curve points as line");
for (j = i - 1 ; j <= i ; j++)
for (j = i - 2 ; j < i ; j++)
{
getPoint4d_p(icurve->points, j, &p4);
ptarray_append_point(ptarray, &p4, LW_TRUE);
......@@ -349,6 +353,10 @@ lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad)
{
lines[i] = (LWGEOM *)lwline_construct(mcurve->srid, NULL, ptarray_clone_deep(((LWLINE *)tmp)->points));
}
else if (tmp->type == COMPOUNDTYPE)
{
lines[i] = (LWGEOM *)lwcompound_segmentize((LWCOMPOUND *)tmp, perQuad);
}
else
{
lwerror("Unsupported geometry found in MultiCurve.");
......@@ -464,6 +472,28 @@ lwgeom_segmentize(LWGEOM *geom, uint32_t perQuad)
return ogeom;
}
/**
* Return ABC angle in radians
* TODO: move to lwalgorithm
*/
static double
lw_arc_angle(const POINT2D *a, const POINT2D *b, const POINT2D *c)
{
POINT2D ab, cb;
ab.x = b->x - a->x;
ab.y = b->y - a->y;
cb.x = b->x - c->x;
cb.y = b->y - c->y;
double dot = (ab.x * cb.x + ab.y * cb.y); /* dot product */
double cross = (ab.x * cb.y - ab.y * cb.x); /* cross product */
double alpha = atan2(cross, dot);
return alpha;
}
/**
* Returns LW_TRUE if b is on the arc formed by a1/a2/a3, but not within
......@@ -492,7 +522,17 @@ static int pt_continues_arc(const POINT4D *a1, const POINT4D *a2, const POINT4D
{
int a2_side = lw_segment_side(t1, t3, t2);
int b_side = lw_segment_side(t1, t3, tb);
double angle1 = lw_arc_angle(t1, t2, t3);
double angle2 = lw_arc_angle(t2, t3, tb);
/* Is the angle similar to the previous one ? */
diff = fabs(angle1 - angle2);
LWDEBUGF(4, " angle1: %g, angle2: %g, diff:%g", angle1, angle2, diff);
if ( diff > EPSILON_SQLMM )
{
return LW_FALSE;
}
/* Is the point b on the same side of a1/a3 as the mid-point a2 is? */
/* If not, it's in the unbounded part of the circle, so it continues the arc, return true. */
if ( b_side != a2_side )
......@@ -525,7 +565,7 @@ circstring_from_pa(const POINTARRAY *pa, int srid, int start, int end)
LWDEBUGF(4, "srid=%d, start=%d, end=%d", srid, start, end);
getPoint4d_p(pa, start, &p0);
ptarray_set_point4d(pao, 0, &p0);
getPoint4d_p(pa, (start+end)/2, &p1);
getPoint4d_p(pa, (start+end+1)/2, &p1);
ptarray_set_point4d(pao, 1, &p1);
getPoint4d_p(pa, end+1, &p2);
ptarray_set_point4d(pao, 2, &p2);
......@@ -547,13 +587,16 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
{
int i = 0, j, k;
POINT4D a1, a2, a3, b;
POINT4D first, center;
char *edges_in_arcs;
int found_arc = LW_FALSE;
int current_arc = 1;
int num_edges;
int edge_type = -1;
int edge_type; /* non-zero if edge is part of an arc */
int start, end;
LWCOLLECTION *outcol;
/* Minimum number of edges, per quadrant, required to define an arc */
const unsigned int min_quad_edges = 2;
/* Die on null input */
if ( ! points )
......@@ -572,18 +615,24 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
/* Allocate our result array of vertices that are part of arcs */
num_edges = points->npoints - 1;
edges_in_arcs = lwalloc(num_edges);
memset(edges_in_arcs, 0, num_edges);
edges_in_arcs = lwalloc(num_edges + 1);
memset(edges_in_arcs, 0, num_edges + 1);
/* We make a candidate arc of the first two edges, */
/* And then see if the next edge follows it */
while( i < num_edges-2 )
{
unsigned int arc_edges;
double num_quadrants;
double angle;
found_arc = LW_FALSE;
/* Make candidate arc */
getPoint4d_p(points, i , &a1);
getPoint4d_p(points, i+1, &a2);
getPoint4d_p(points, i+2, &a3);
memcpy(&first, &a1, sizeof(POINT4D));
for( j = i+3; j < num_edges+1; j++ )
{
LWDEBUGF(4, "i=%d, j=%d", i, j);
......@@ -604,10 +653,40 @@ pta_desegmentize(POINTARRAY *points, int type, int srid)
current_arc++;
break;
}
memcpy(&a1, &a2, sizeof(POINT4D));
memcpy(&a2, &a3, sizeof(POINT4D));
memcpy(&a3, &b, sizeof(POINT4D));
}
/* Jump past all the edges that were added to the arc */
if ( found_arc )
{
/* Check if an arc was composed by enough edges to be
* really considered an arc
* See http://trac.osgeo.org/postgis/ticket/2420
*/
arc_edges = j - 1 - i;
LWDEBUGF(4, "arc defined by %d edges found", arc_edges);
if ( first.x == b.x &&