Commit 611e880c authored by Bas Couwenberg's avatar Bas Couwenberg

New upstream version 2.4.2+dfsg

parent c0eda985
......@@ -11,14 +11,11 @@
*.gcda
*.gcno
gmon.out
install-sh
postgis_svn_revision.h
aclocal.m4
autom4te.cache/
config.guess
config.log
config.status
config.sub
configure
de9i*.png
doc/html/image_src/generator
......@@ -87,6 +84,7 @@ loader/pgsql2shp
loader/shp2pgsql
loader/shp2pgsql-gui
ltmain.sh
build-aux/
macros/libtool.m4
macros/lt~obsolete.m4
macros/ltoptions.m4
......
2017-11-14 05:42 Regina Obe <lr@pcorp.us>
* [r16108] doc/extras_tigergeocoder.xml: note about enhanced
feature in reverse_geocode when zcta5 data is loaded.
2017-11-09 09:06 Regina Obe <lr@pcorp.us>
* [r16102] NEWS, extensions/upgradeable_versions.mk: Add missing
2.3.4 upgrade path (as provided by Muhammad Usama)
Also remove 2.3 and 2.4 dev releases and add missing 2.2.6
Closes #3926 for PostGIS 2.4.2
2017-11-09 08:53 Regina Obe <lr@pcorp.us>
* [r16099] NEWS: fix spacing
2017-11-09 08:52 Regina Obe <lr@pcorp.us>
* [r16098] NEWS: Add missing release notes for ST_Segmentize
geography fix.
References #3667 for PostGIS 2.4.2
2017-11-07 18:04 Paul Ramsey <pramsey@cleverelephant.ca>
* [r16094] liblwgeom/cunit/cu_geodetic.c, liblwgeom/lwgeodetic.c,
regress/geography_expected: Replace project-and-entend logic with
bisect-and-recurse in geography segmentization.
Preserves "mostly equal" segment lengths, and
should be more numerically stable.
Backport to 2.4.
References #3667
2017-10-31 15:15 Sandro Santilli <strk@kbt.io>
* [r16086] configure.ac, liblwgeom/Makefile.in: Make sure target
directories are created before copying files to them
References #3912 for 2.4 branch
References #3916 for 2.4 branch
2017-10-26 01:07 Regina Obe <lr@pcorp.us>
* [r16061] NEWS: Fix zcta5 load - NEWS item
References #3917 for PostGIS 2.4.2
2017-10-26 01:06 Regina Obe <lr@pcorp.us>
* [r16060] extras/tiger_geocoder/tiger_loader_2017.sql: Fix zcta5
load
References #3917 for PostGIS 2.4.2
2017-10-21 09:02 Sandro Santilli <strk@kbt.io>
* [r16029] .gitignore, GNUmakefile.in, configure.ac,
liblwgeom/Makefile.in, loader/Makefile.in, raster/install-sh,
raster/loader/Makefile.in, utils/Makefile.in: Put build AUX files
under build-aux
Cleans and ignore build aux files from new location,
and remove spurious install-sh from repository.
References #3912 for 2.4 branch
2017-10-20 13:05 Paul Ramsey <pramsey@cleverelephant.ca>
* [r16018] raster/rt_pg/Makefile.in: Reflect CFLAGS passed into
core
2017-10-20 13:04 Paul Ramsey <pramsey@cleverelephant.ca>
* [r16017] postgis/Makefile.in: Reflect CFLAGS passed into
configure
2017-10-18 19:28 Paul Ramsey <pramsey@cleverelephant.ca>
* [r16014] liblwgeom/lwgeom_geos.c, postgis/geobuf.c,
postgis/geography_centroid.c, postgis/gserialized_gist_2d.c,
postgis/lwgeom_functions_basic.c, postgis/mvt.c: Quiet compile
warnings
2017-10-18 18:46 Paul Ramsey <pramsey@cleverelephant.ca>
* [r16013] HOWTO_RELEASE, NEWS, README.postgis, Version.config,
extensions/upgradeable_versions.mk: Bump forward versions
2017-10-18 18:32 Paul Ramsey <pramsey@cleverelephant.ca>
* [r16011] ChangeLog, NEWS, README.postgis, Version.config,
doc/release_notes.xml: Prepare for 2.4.1 release
2017-10-17 18:23 Regina Obe <lr@pcorp.us>
* [r16001] doc/introduction.xml:
......@@ -58,8 +58,7 @@ distclean-local: clean-local
maintainer-clean-local: distclean-local
rm -f configure
rm -f config.guess config.rpath config.sub
rm -f libtool install-sh ltmain.sh
rm -Rf build-aux
maintainer-clean:
@echo '------------------------------------------------------'
......
PostGIS 2.4.2
2017/11/15
* Bug fixes *
- #3917, Fix zcta5 load
- #3667, Fix for bug in geography ST_Segmentize
- #3926, Add missing 2.2.6 and 2.3.4 upgrade paths (Muhammad Usama)
PostGIS 2.4.1
2017/10/18
......
PostGIS - Geographic Information Systems Extensions to PostgreSQL
=================================================================
:Version: 2.4.1
:Date: 2017-10-18
:Version: 2.4.2
:Date: 2017-11-15
:Website: http://postgis.net
This distribution contains a module which implements GIS simple features, ties
......
......@@ -5,7 +5,7 @@
POSTGIS_MAJOR_VERSION=2
POSTGIS_MINOR_VERSION=4
POSTGIS_MICRO_VERSION=1
POSTGIS_MICRO_VERSION=2
# Liblwgeom interface versioning, reset to 0:0:0 (cur:age:rev)
# when changing POSTGIS_MINOR_VERSION
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -708,9 +708,6 @@ GETTEXT_MACRO_VERSION
USE_NLS
mkdir_p
MKDIR_P
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
SET_MAKE
HAVE_SFCGAL
SFCGAL
......@@ -814,6 +811,9 @@ build_vendor
build_cpu
build
LIBTOOL
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
target_alias
host_alias
build_alias
......@@ -2434,10 +2434,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers postgis_config.h"
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
for ac_dir in build-aux "$srcdir"/build-aux; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
......@@ -2453,7 +2451,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
......@@ -2465,6 +2463,100 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in #((
./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
echo one > conftest.one
echo two > conftest.two
mkdir conftest.dir
if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
test -s conftest.one && test -s conftest.two &&
test -s conftest.dir/conftest.one &&
test -s conftest.dir/conftest.two
then
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
......@@ -14104,99 +14196,6 @@ $as_echo "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
# Reject install programs that cannot install multiple files.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
# Account for people who put trailing slashes in PATH elements.
case $as_dir/ in #((
./ | .// | /[cC]/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
echo one > conftest.one
echo two > conftest.two
mkdir conftest.dir
if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
test -s conftest.one && test -s conftest.two &&
test -s conftest.dir/conftest.one &&
test -s conftest.dir/conftest.two
then
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
# As a last resort, use the slow shell script. Don't cache a
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
......
......@@ -12,7 +12,8 @@ dnl **********************************************************************
AC_INIT()
AC_CONFIG_HEADERS([postgis_config.h])
AC_CONFIG_MACRO_DIR([macros])
AC_CONFIG_AUX_DIR([build-aux])
AC_PROG_INSTALL
dnl Invoke libtool: we do this as it is the easiest way to find the PIC
dnl flags required to build liblwgeom
......
......@@ -1235,7 +1235,8 @@ SELECT address As orig, (g.na).streetname, (g.na).streettypeabbrev
</listitem>
</orderedlist>
<!-- use this format if new function -->
<para>Enhanced: 2.4.1 if optional zcta5 dataset is loaded, the reverse_geocode function can resolve to state and zip even if the specific state data is not loaded. Refer to <xref linkend="Loader_Generate_Nation_Script" /> for details on loading zcta5 data.</para>
<para>Availability: 2.0.0 </para>
</refsection>
......@@ -1288,7 +1289,7 @@ FROM (SELECT address As actual_addr, lon, lat,
<refsection>
<title>See Also</title>
<para><xref linkend="Pprint_Addy" />, <xref linkend="Geocode" /></para>
<para><xref linkend="Pprint_Addy" />, <xref linkend="Geocode" />, <xref linkend="Loader_Generate_Nation_Script" /></para>
</refsection>
</refentry>
......
......@@ -30,14 +30,14 @@ POSTGIS_PGSQL_VERSION=96
SQLPP = /usr/bin/cpp -traditional-cpp -w -P
GREP=/usr/bin/grep
PERL=/opt/local/bin/perl
EXTVERSION = 2.4.1
EXTVERSION = 2.4.2
MINORVERSION = 2.4
MODULE_big = address_standardizer-2.4
EXTENSION = address_standardizer
DATA = address_standardizer_data_us.control sql/$(EXTENSION).sql sql/$(EXTENSION)_data_us.sql
all: sql/address_standardizer.sql sql/address_standardizer--1.0--$(EXTVERSION).sql sql/address_standardizer--$(EXTVERSION).sql sql/address_standardizer--$(EXTVERSION)--$(EXTVERSION)next.sql sql/address_standardizer--$(EXTVERSION)next--$(EXTVERSION).sql \
sql/$(EXTENSION)_data_us.sql sql/address_standardizer--2.4.1.sql sql/$(EXTENSION)_data_us--2.4.1.sql sql/$(EXTENSION)_data_us--$(EXTVERSION)--$(EXTVERSION)next.sql \
sql/$(EXTENSION)_data_us.sql sql/address_standardizer--2.4.2.sql sql/$(EXTENSION)_data_us--2.4.2.sql sql/$(EXTENSION)_data_us--$(EXTVERSION)--$(EXTVERSION)next.sql \
sql/$(EXTENSION)_data_us--$(EXTVERSION)next--$(EXTVERSION).sql \
sql/test-init-extensions.sql sql/test-parseaddress.sql sql/test-standardize_address_1.sql sql/test-standardize_address_2.sql
......@@ -68,7 +68,7 @@ sql/%.sql: %.sql.in
$(SQLPP) -I../libpgcommon $< | grep -v '^#' | \
$(PERL) -lpe "s'MODULE_PATHNAME'\$$libdir/${EXTENSION}-${MINORVERSION}'g" > $@
sql/address_standardizer--2.4.1.sql: sql/address_standardizer_types.sql \
sql/address_standardizer--2.4.2.sql: sql/address_standardizer_types.sql \
sql/address_standardizer_functions.sql
cat $^ > $@
......
# address_standardizer extension
comment = 'Used to parse an address into constituent elements. Generally used to support geocoding address normalization step.'
default_version = '2.4.1'
default_version = '2.4.2'
relocatable = true
# address standardizer us dataset
comment = 'Address Standardizer US dataset example'
default_version = '2.4.1'
default_version = '2.4.2'
relocatable = true
# postgis extension
comment = 'PostGIS geometry, geography, and raster spatial types and functions'
default_version = '2.4.1'
default_version = '2.4.2'
module_pathname = '$libdir/postgis-2.4'
relocatable = false
include ../upgradeable_versions.mk
EXTENSION = postgis_sfcgal
EXTVERSION = 2.4.1
EXTVERSION = 2.4.2
MINORVERSION = 2.4
GREP = /usr/bin/grep
PERL = /opt/local/bin/perl
......
# postgis topology extension
comment = 'PostGIS SFCGAL functions'
default_version = '2.4.1'
default_version = '2.4.2'
relocatable = true
requires = postgis
# postgis tiger geocoder extension
comment = 'PostGIS tiger geocoder and reverse geocoder'
default_version = '2.4.1'
default_version = '2.4.2'
relocatable = false
schema = tiger
requires = 'postgis,fuzzystrmatch'
# postgis topology extension
comment = 'PostGIS topology spatial types and functions'
default_version = '2.4.1'
default_version = '2.4.2'
relocatable = false
schema = topology
requires = postgis
......@@ -23,12 +23,14 @@ UPGRADEABLE_VERSIONS = \
2.2.3 \
2.2.4 \
2.2.5 \
2.2.6 \
2.3.0 \
2.3.1 \
2.3.2 \
2.3.3 \
2.4.0rc1 \
2.4.0rc2 \
2.4.0rc3 \
2.4.0dev \
2.4.0
2.3.4 \
2.3.5 \
2.4.0 \
2.4.1 \
2.4.2dev
......@@ -315,9 +315,9 @@ ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_count
INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, level_nation, single_geom_mode, insert_mode, pre_load_process, post_load_process, columns_exclude )
VALUES(13, 'zcta5_raw', 'zcta510', false,false, false,true, false, 'c',
'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}( zcta5 character varying(5), classfp character varying(2),mtfcc character varying(5), funcstat character varying(1), aland double precision, awater double precision, intptlat character varying(11), intptlon character varying(12), geom geometry(MultiPolygon,4269) );"',
'${psql} -c "CREATE TABLE ${data_schema}.${lookup_name}( zcta5 character varying(5), classfp character varying(2),mtfcc character varying(5), funcstat character varying(1), aland double precision, awater double precision, intptlat character varying(11), intptlon character varying(12), the_geom geometry(MultiPolygon,4269) );"',
$post_load$${psql} -c "ALTER TABLE tiger.zcta5 DROP CONSTRAINT IF EXISTS enforce_geotype_the_geom; CREATE TABLE ${data_schema}.zcta5_all(CONSTRAINT pk_zcta5_all PRIMARY KEY (zcta5ce,statefp), CONSTRAINT uidx_${lookup_name}_all_gid UNIQUE (gid)) INHERITS(tiger.zcta5);
${psql} -c "SELECT loader_load_staged_data(lower('${table_name}'), lower('${lookup_name}'));"
${psql} -c "SELECT loader_load_staged_data(lower('${table_name}'), lower('${lookup_name}'));"
${psql} -c "INSERT INTO ${data_schema}.zcta5_all(statefp, zcta5ce, classfp, mtfcc, funcstat, aland, awater, intptlat, intptlon, partflg, the_geom) SELECT s.statefp, z.zcta5, z.classfp, z.mtfcc, z.funcstat, z.aland, z.awater, z.intptlat, z.intptlon, CASE WHEN ST_Covers(s.the_geom, z.the_geom) THEN 'N' ELSE 'Y' END, ST_SnapToGrid(ST_Transform(CASE WHEN ST_Covers(s.the_geom, z.the_geom) THEN ST_SimplifyPreserveTopology(ST_Transform(z.the_geom,2163),1000) ELSE ST_SimplifyPreserveTopology(ST_Intersection(ST_Transform(s.the_geom,2163), ST_Transform(z.the_geom,2163)),1000) END,4269), 0.000001) As geom FROM ${data_schema}.zcta5_raw AS z INNER JOIN tiger.state AS s ON (ST_Covers(s.the_geom, z.the_geom) or ST_Overlaps(s.the_geom, z.the_geom) );"
${psql} -c "DROP TABLE ${data_schema}.zcta5_raw; CREATE INDEX idx_${data_schema}_zcta5_all_the_geom_gist ON ${data_schema}.zcta5_all USING gist(the_geom);"$post_load$
, ARRAY['gid','geoid','geoid10', 'partflg']);
......
......@@ -33,7 +33,7 @@ exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
SHELL = @SHELL@
INSTALL = $(SHELL) ../install-sh
INSTALL = @INSTALL@
LIBTOOL = @LIBTOOL@
SOVER = @POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
......@@ -163,7 +163,9 @@ install: install-liblwgeom
uninstall: uninstall-liblwgeom
install-liblwgeom: liblwgeom.la
$(INSTALL) -d "$(DESTDIR)$(libdir)"
$(LIBTOOL) --mode=install $(INSTALL) liblwgeom.la "$(DESTDIR)$(libdir)/liblwgeom.la"
$(INSTALL) -d "$(DESTDIR)$(includedir)"
$(INSTALL) -m 0644 liblwgeom.h "$(DESTDIR)$(includedir)/liblwgeom.h"
$(INSTALL) -m 0644 liblwgeom_topo.h "$(DESTDIR)$(includedir)/liblwgeom_topo.h"
......
......@@ -1526,8 +1526,8 @@ static void test_lwgeom_segmentize_sphere(void)
lwg1 = lwgeom_from_wkt("LINESTRING(0 20, 5 20)", LW_PARSER_CHECK_NONE);
lwg2 = lwgeom_segmentize_sphere(lwg1, max);
lwl = (LWLINE*)lwg2;
//wkt = lwgeom_to_ewkt(lwg2);
CU_ASSERT_EQUAL(lwl->points->npoints, 7);
// printf("%s\n", lwgeom_to_ewkt(lwg2));
CU_ASSERT_EQUAL(lwl->points->npoints, 9);
lwgeom_free(lwg1);
lwgeom_free(lwg2);
//lwfree(wkt);
......
......@@ -1539,6 +1539,49 @@ void gbox_pt_outside(const GBOX *gbox, POINT2D *pt_outside)
}
static int ptarray_segmentize_sphere_edge_recursive (
const POINT3D *p1, const POINT3D *p2, /* 3-space points we are interpolating beween */
const POINT4D *v1, const POINT4D *v2, /* real values and z/m values */
double d, double max_seg_length, /* current segment length and segment limit */
POINTARRAY *pa) /* write out results here */
{
/* Reached the terminal leaf in recursion. Add */
/* the left-most point to the pointarray here */
/* We recurse down the left side first, so outputs should */
/* end up added to the array in order this way */
if (d <= max_seg_length)
{
GEOGRAPHIC_POINT g;
POINT4D p;
cart2geog(p1, &g);
p.x = rad2deg(g.lon);
p.y = rad2deg(g.lat);
p.z = v1->z;
p.m = v1->m;
return ptarray_append_point(pa, &p, LW_FALSE);
}
/* Find the mid-point and recurse on the left and then the right */
else
{
/* Calculate mid-point */
POINT3D mid;
mid.x = (p1->x + p2->x) / 2.0;
mid.y = (p1->y + p2->y) / 2.0;
mid.z = (p1->z + p2->z) / 2.0;
normalize(&mid);
/* Calculate z/m mid-values */
/* (ignore x/y, we get those from the 3-space calculations) */
POINT4D midv;
midv.z = (v1->z + v2->z) / 2.0;
midv.m = (v1->m + v2->m) / 2.0;
/* Recurse on the left first */
ptarray_segmentize_sphere_edge_recursive(p1, &mid, v1, &midv, d/2.0, max_seg_length, pa);
ptarray_segmentize_sphere_edge_recursive(&mid, p2, &midv, v2, d/2.0, max_seg_length, pa);
return LW_SUCCESS;
}
}
/**
* Create a new point array with no segment longer than the input segment length (expressed in radians!)
* @param pa_in - input point array pointer
......@@ -1550,92 +1593,50 @@ ptarray_segmentize_sphere(const POINTARRAY *pa_in, double max_seg_length)
POINTARRAY *pa_out;
int hasz = ptarray_has_z(pa_in);
int hasm = ptarray_has_m(pa_in);
int pa_in_offset = 0; /* input point offset */
POINT4D p1, p2, p;
GEOGRAPHIC_POINT g1, g2, g;
double d;
POINT4D p1, p2;
POINT3D q1, q2;
GEOGRAPHIC_POINT g1, g2;
int i;
/* Just crap out on crazy input */
if ( ! pa_in )
lwerror("ptarray_segmentize_sphere: null input pointarray");
lwerror("%s: null input pointarray", __func__);
if ( max_seg_length <= 0.0 )
lwerror("ptarray_segmentize_sphere: maximum segment length must be positive");
lwerror("%s: maximum segment length must be positive", __func__);
/* Empty starting array */
pa_out = ptarray_construct_empty(hasz, hasm, pa_in->npoints);
/* Add first point */
getPoint4d_p(pa_in, pa_in_offset, &p1);
ptarray_append_point(pa_out, &p1, LW_FALSE);
geographic_point_init(p1.x, p1.y, &g1);
pa_in_offset++;
while ( pa_in_offset < pa_in->npoints )
/* Simple loop per edge */
for (i = 1; i < pa_in->npoints; i++)
{
getPoint4d_p(pa_in, pa_in_offset, &p2);
getPoint4d_p(pa_in, i-1, &p1);
getPoint4d_p(pa_in, i, &p2);
geographic_point_init(p1.x, p1.y, &g1);
geographic_point_init(p2.x, p2.y, &g2);
/* Skip duplicate points (except in case of 2-point lines!) */
if ( (pa_in->npoints > 2) && p4d_same(&p1, &p2) )
{
/* Move one offset forward */
p1 = p2;
g1 = g2;
pa_in_offset++;
if ((pa_in->npoints > 2) && p4d_same(&p1, &p2))
continue;
}
/* How long is this edge? */
d = sphere_distance(&g1, &g2);
double d = sphere_distance(&g1, &g2);
/* We need to segmentize this edge */
if ( d > max_seg_length )
if (d > max_seg_length)
{
int nsegs = 1 + d / max_seg_length;
int i;
double dzz = 0, dmm = 0;
double delta = d / nsegs;
/* The independent Z/M values on the ptarray */
if ( hasz ) dzz = (p2.z - p1.z) / nsegs;
if ( hasm ) dmm = (p2.m - p1.m) / nsegs;
g = g1;
p = p1;
for ( i = 0; i < nsegs - 1; i++ )
{
GEOGRAPHIC_POINT gn;
double heading;
/* Compute the current heading to the destination */
heading = sphere_direction(&g, &g2, (nsegs-i) * delta);
/* Move one increment forwards */
sphere_project(&g, delta, heading, &gn);
g = gn;
p.x = rad2deg(g.lon);
p.y = rad2deg(g.lat);
if ( hasz )
p.z += dzz;
if ( hasm )
p.m += dmm;
ptarray_append_point(pa_out, &p, LW_FALSE);
}
ptarray_append_point(pa_out, &p2, LW_FALSE);
geog2cart(&g1, &q1);
geog2cart(&g2, &q2);
/* 3-d end points, XYZM end point, current edge size, min edge size */