Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Integrate wagyu to validate MVT polygons #356

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f427c98
WIP: Bring wagyu
Algunenano Dec 17, 2018
450cf0f
wagyu: Initial setup
Algunenano Dec 18, 2018
cfb16a5
Wagyu: Implement bridge between systems
Algunenano Dec 19, 2018
1b5d9ff
MVTGeom: Reorder and extract clipping and validation
Algunenano Dec 19, 2018
bc41cf5
MVT: Use Wagyu if available
Algunenano Dec 19, 2018
b4ef9ac
Wagyu: Remove autogenerated Makefiles from the project
Algunenano Dec 19, 2018
32ba982
Wagyu: Remove notices (not linked)
Algunenano Dec 19, 2018
d398654
Waygu: Only calculate bbox if necessary
Algunenano Dec 21, 2018
6c23223
Wagyu: Use ints internally instead of doubles
Algunenano Dec 21, 2018
258cb5e
Wagyu: Only check for it if protobuf is available
Algunenano Dec 21, 2018
3645997
Wagyu: Show library version in postgis_full_version
Algunenano Dec 21, 2018
bf1c651
Wagyu: Don't mixed declarations and code
Algunenano Dec 21, 2018
57ae1da
Wagyu: Update README
Algunenano Dec 21, 2018
f798b40
MVT: Extract basic type geometries first
Algunenano Dec 26, 2018
bfe4ede
ST_AsMVTGeom: Always return the simplest geometry
Algunenano Dec 26, 2018
1abb0a4
ST_MVTGeom: Enforce SRID = 0
Algunenano Dec 26, 2018
ce258d0
MVTGeom: Uniformize tests to match behaviour or GEOS and Wagyu
Algunenano Dec 27, 2018
366e6f0
ST_AsMVT (GEOS): Make sure it doesn't output float values after
Algunenano Jan 8, 2019
a9def8c
Wagyu: Use sorted insert with vector
Algunenano Jan 8, 2019
a535471
Wagyu: Use fast clip
Algunenano Jan 8, 2019
6f3c8e0
Wagyu: Discard outside polygons before clipping
Algunenano Jan 9, 2019
18800d3
Wagyu: Proper discard
Algunenano Jan 9, 2019
82a8b08
Wagyu: Move bbox clipping to the adaptor
Algunenano Jan 9, 2019
a9426a1
Wagyu: Build only when really needed
Algunenano Jan 9, 2019
93a1ead
Wagyu: Test with 32b ints
Algunenano Jan 9, 2019
d6529af
MVT test: Adapt input to have the same output edge points
Algunenano Jan 9, 2019
9126fd9
Wagyu: Enable interruptions
Algunenano Jan 9, 2019
ff38766
Merge svn-trunk for tests
Algunenano Jan 9, 2019
9832c13
Wagyu: Integrate with CI
Algunenano Jan 11, 2019
04ffcbb
Wagyu: Adapt Makefile to build as libpgcommon
Algunenano Jan 11, 2019
c2053c0
Address old compiler warnings
Algunenano Jan 11, 2019
c2b0852
More warnings
Algunenano Jan 11, 2019
04faf32
Wagyu: Improve bounding box checking
Algunenano Jan 11, 2019
e4bbe19
MVT: Add extra tests around clipping and simplification
Algunenano Jan 11, 2019
ceeb640
Travis: Do not build twice the coverage run
Algunenano Jan 11, 2019
e538bf3
Codecov: Ignore wagyu library files
Algunenano Jan 11, 2019
9ae90bc
postgis_full_version: Uniformize log level on errors
Algunenano Jan 11, 2019
c00631c
Merge remote-tracking branch 'blessed/svn-trunk' into libwagyu
Algunenano Jan 21, 2019
b8f60e2
Wagyu: Go back to using libtool
Algunenano Jan 22, 2019
ba03394
Merge remote-tracking branch 'blessed/svn-trunk' into libwagyu
Algunenano Jan 22, 2019
a7806e4
Revert "Wagyu: Go back to using libtool"
Algunenano Jan 23, 2019
da68c19
Update doc with wagyu information
Algunenano Jan 25, 2019
80f760c
Missing postgis_wagyu_version references
Algunenano Jan 25, 2019
e380449
Wagyu: Update from upstream to support interruptions
Algunenano Jan 25, 2019
7db96a2
Merge remote-tracking branch 'blessed/svn-trunk' into libwagyu
Algunenano Jan 29, 2019
df601e6
Merge remote-tracking branch 'blessed/svn-trunk' into libwagyu
Algunenano Jan 30, 2019
040cc3e
Wagyu: Doc improvements
Algunenano Feb 5, 2019
059cfb9
Merge remote-tracking branch 'blessed/svn-trunk' into libwagyu
Algunenano Feb 5, 2019
e8cda3f
Add NEWS
Algunenano Feb 5, 2019
186ad1e
Adapt to the changes in the coverage build
Algunenano Feb 5, 2019
f33016e
Update comments before push
Algunenano Feb 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ coverage:
default:
threshold: 0.2%
comment: false
ignore:
- "deps/wagyu/include/**/*" # Ignore wagyu library files
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ postgis/uninstall_sfcgal.sql
# LLVM JIT
*.bc
*.ll

deps/Makefile
deps/wagyu/Makefile
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
- tag=pg11-geos37-gdal24-proj52 mode=coverage
- tag=pg11-geos37-gdal24-proj52 mode=usan_gcc
- tag=pg11-geos37-gdal24-proj52 mode=usan_clang
- tag=pg11-geos37-gdal24-proj52 mode=wagyu
- tag=pg11-geos37-gdal24-proj52 mode=tests
- tag=pg10-geos36-gdal23-proj49 mode=tests
- tag=pg96-geos36-gdal22-proj49 mode=tests
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

SUBDIRS = liblwgeom
ifeq (@LIBLWGEOM_ONLY@,no)
SUBDIRS += libpgcommon postgis regress @RASTER@ @TOPOLOGY@ loader utils doc @EXTENSIONS@
SUBDIRS += libpgcommon postgis regress @RASTER@ @TOPOLOGY@ loader utils doc @EXTENSIONS@ @DEPS_SUBDIR@
endif

POSTGIS_MAJOR_VERSION=@POSTGIS_MAJOR_VERSION@
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ PostGIS 3.0.0
within, equals (Esteban Zimányi and Arthur Lesuisse from Université
Libre de Bruxelles (ULB), Darafei Praliaskouski)
- #4171, ST_3DLineInterpolatePoint (Julien Cabieces, Vincent Mora)
- #4311, Introduce `--with-wagyu` as an option for MVT polygons (Raúl Marín)

* Enhancements and fixes *
- #4153, ST_Segmentize now splits segments proportionally (Darafei
Expand Down
18 changes: 18 additions & 0 deletions ci/travis/run_wagyu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e

WARNINGS="-Werror -Wall -Wextra -Wformat -Werror=format-security"
WARNINGS_DISABLED="-Wno-unused-parameter -Wno-implicit-fallthrough -Wno-cast-function-type"

# Build with coverage
CFLAGS="-g -O0 --coverage -mtune=generic -fno-omit-frame-pointer ${WARNINGS} ${WARNINGS_DISABLED}"
LDFLAGS="--coverage"

/usr/local/pgsql/bin/pg_ctl -c -l /tmp/logfile start
./autogen.sh

# Standard build
./configure --with-wagyu CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
bash ./ci/travis/logbt -- make -j check RUNTESTFLAGS=--verbose
curl -S -f https://codecov.io/bash -o .github/codecov.bash
bash .github/codecov.bash
48 changes: 47 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,46 @@ else
fi


dnl ===========================================================================
dnl Deps folder
dnl ===========================================================================

DEPS_MAKEFILE_LIST="
deps/Makefile"


dnl ===========================================================================
dnl Wagyu
dnl ===========================================================================

dnl Wagyu will only be necessary if protobuf is present to build MVTs

HAVE_WAGYU=no
if test "x$HAVE_PROTOBUF" = "xyes"; then
AC_ARG_WITH(
[wagyu],
AC_HELP_STRING([--with-wagyu], [Use the wagyu library]),
[HAVE_WAGYU=yes],
[HAVE_WAGYU=no])

if test "x$HAVE_WAGYU" = "xyes"; then
AC_MSG_RESULT([WAGYU: Wagyu usage requested])

DEPS_SUBDIR="deps"
AC_SUBST([DEPS_SUBDIR])

WAGYU_LIB=libwagyu.la
AC_SUBST([WAGYU_LIB])

AC_PROG_CXX
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)

AC_DEFINE([HAVE_WAGYU], [1], [Define to 1 if wagyu is being built])
AC_SUBST([HAVE_WAGYU])
DEPS_MAKEFILE_LIST="$DEPS_MAKEFILE_LIST
deps/wagyu/Makefile"
fi
fi



Expand Down Expand Up @@ -1471,7 +1511,8 @@ AC_OUTPUT([GNUmakefile
doc/Makefile.comments
doc/html/image_src/Makefile
utils/Makefile
$RT_MAKEFILE_LIST])
$RT_MAKEFILE_LIST
$DEPS_MAKEFILE_LIST])

dnl ===========================================================================
dnl Display the configuration status information
Expand All @@ -1482,6 +1523,9 @@ AC_MSG_RESULT([ PostGIS is now configured for ${host}])
AC_MSG_RESULT()
AC_MSG_RESULT([ -------------- Compiler Info ------------- ])
AC_MSG_RESULT([ C compiler: ${CC} ${CFLAGS}])
if test "x$HAVE_WAGYU" = "xyes"; then
AC_MSG_RESULT([ C++ compiler: ${CXX} ${CXXFLAGS}])
fi
AC_MSG_RESULT([ SQL preprocessor: ${SQLPP}])
AC_MSG_RESULT()
AC_MSG_RESULT([ -------------- Additional Info ------------- ])
Expand Down Expand Up @@ -1520,6 +1564,8 @@ AC_MSG_RESULT([ JSON-C support: ${HAVE_JSON}])
AC_MSG_RESULT([ protobuf-c support: ${HAVE_PROTOBUF}])
AC_MSG_RESULT([ PCRE support: ${HAVE_PCRE}])
AC_MSG_RESULT([ Perl: ${PERL}])
AC_MSG_RESULT([ Wagyu: ${HAVE_WAGYU}])

AC_MSG_RESULT()
AC_MSG_RESULT([ --------------- Extensions --------------- ])
if test "x$RASTER" = "xraster"; then
Expand Down
50 changes: 50 additions & 0 deletions deps/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#/**********************************************************************
# *
# * PostGIS - Spatial Types for PostgreSQL
# * http://postgis.net
# *
# * PostGIS is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 2 of the License, or
# * (at your option) any later version.
# *
# * PostGIS is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
# *
# **********************************************************************
# *
# * Copyright 2019 Raúl Marín
# *
# **********************************************************************/

CC=@CC@
CXX=@CXX@
CFLAGS=-I../liblwgeom @WARNFLAGS@ @CFLAGS@ @PICFLAGS@
CXXFLAGS=-I../liblwgeom @WARNFLAGS@ @CXXFLAGS@ @PICFLAGS@
LDFLAGS = @LDFLAGS@
top_builddir = @top_builddir@
libdir = @libdir@
LIBTOOL = @LIBTOOL@

all: @WAGYU_LIB@

@WAGYU_LIB@:
$(MAKE) -C wagyu $@

install:

uninstall:

check:

clean:
$(MAKE) -C wagyu $@

distclean: clean
$(MAKE) -C wagyu $@
rm -f Makefile
56 changes: 56 additions & 0 deletions deps/wagyu/LICENSE.README
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# LICENSE.geometry applies to:

include/
└── mapbox
├── feature.hpp
├── geometry
│   ├── box.hpp
│   ├── empty.hpp
│   ├── envelope.hpp
│   ├── for_each_point.hpp
│   ├── geometry.hpp
│   ├── line_string.hpp
│   ├── multi_line_string.hpp
│   ├── multi_point.hpp
│   ├── multi_polygon.hpp
│   ├── point_arithmetic.hpp
│   ├── point.hpp
│   └── polygon.hpp
├── geometry.hpp
└── geometry_io.hpp

2 directories, 15 files

# LICENSE.wagyu applies to:

include/
└── mapbox
└── geometry
└── wagyu
├── active_bound_list.hpp
├── bound.hpp
├── bubble_sort.hpp
├── build_edges.hpp
├── build_local_minima_list.hpp
├── build_result.hpp
├── config.hpp
├── edge.hpp
├── interrupt.hpp
├── intersect.hpp
├── intersect_util.hpp
├── local_minimum.hpp
├── local_minimum_util.hpp
├── point.hpp
├── process_horizontal.hpp
├── process_maxima.hpp
├── quick_clip.hpp
├── ring.hpp
├── ring_util.hpp
├── scanbeam.hpp
├── snap_rounding.hpp
├── topology_correction.hpp
├── util.hpp
├── vatti.hpp
└── wagyu.hpp

3 directories, 24 files
13 changes: 13 additions & 0 deletions deps/wagyu/LICENSE.geometry
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2016, Mapbox

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
37 changes: 37 additions & 0 deletions deps/wagyu/LICENSE.wagyu
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Parts of the code in the Wagyu Library are derived from the version of the
Clipper Library by Angus Johnson listed below.

Author : Angus Johnson
Version : 6.4.0
Date : 2 July 2015
Website : http://www.angusj.com

Copyright for portions of the derived code in the Wagyu library are held
by Angus Johnson, 2010-2015. All other copyright for the Wagyu Library are held by
Mapbox, 2016. This code is published in accordance with, and retains the same license
as the Clipper Library by Angus Johnson.

Copyright (c) 2010-2015, Angus Johnson
Copyright (c) 2016, Mapbox

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
102 changes: 102 additions & 0 deletions deps/wagyu/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#/**********************************************************************
# *
# * PostGIS - Spatial Types for PostgreSQL
# * http://postgis.net
# *
# * PostGIS is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 2 of the License, or
# * (at your option) any later version.
# *
# * PostGIS is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
# *
# **********************************************************************
# *
# * Copyright 2019 Raúl Marín
# *
# **********************************************************************/

CXX = @CXX@
CXXFLAGS =-I../../liblwgeom -Iinclude @CPPFLAGS@ @WARNFLAGS@ @CXXFLAGS@ @PICFLAGS@
LDFLAGS = @LDFLAGS@
top_builddir = @top_builddir@
libdir = @libdir@
LIBTOOL = @LIBTOOL@

WAGYU_OBJS = \
lwgeom_wagyu.o

WAGYU_HEADERS = \
lwgeom_wagyu.h \
include/mapbox/geometry/polygon.hpp \
include/mapbox/geometry/point_arithmetic.hpp \
include/mapbox/geometry/multi_polygon.hpp \
include/mapbox/geometry/box.hpp \
include/mapbox/geometry/for_each_point.hpp \
include/mapbox/geometry/line_string.hpp \
include/mapbox/geometry/wagyu/process_horizontal.hpp \
include/mapbox/geometry/wagyu/wagyu.hpp \
include/mapbox/geometry/wagyu/ring_util.hpp \
include/mapbox/geometry/wagyu/bubble_sort.hpp \
include/mapbox/geometry/wagyu/snap_rounding.hpp \
include/mapbox/geometry/wagyu/bound.hpp \
include/mapbox/geometry/wagyu/edge.hpp \
include/mapbox/geometry/wagyu/build_result.hpp \
include/mapbox/geometry/wagyu/scanbeam.hpp \
include/mapbox/geometry/wagyu/ring.hpp \
include/mapbox/geometry/wagyu/config.hpp \
include/mapbox/geometry/wagyu/quick_clip.hpp \
include/mapbox/geometry/wagyu/local_minimum_util.hpp \
include/mapbox/geometry/wagyu/process_maxima.hpp \
include/mapbox/geometry/wagyu/intersect.hpp \
include/mapbox/geometry/wagyu/point.hpp \
include/mapbox/geometry/wagyu/util.hpp \
include/mapbox/geometry/wagyu/intersect_util.hpp \
include/mapbox/geometry/wagyu/vatti.hpp \
include/mapbox/geometry/wagyu/active_bound_list.hpp \
include/mapbox/geometry/wagyu/build_local_minima_list.hpp \
include/mapbox/geometry/wagyu/build_edges.hpp \
include/mapbox/geometry/wagyu/local_minimum.hpp \
include/mapbox/geometry/wagyu/topology_correction.hpp \
include/mapbox/geometry/wagyu/interrupt.hpp \
include/mapbox/geometry/geometry.hpp \
include/mapbox/geometry/point.hpp \
include/mapbox/geometry/empty.hpp \
include/mapbox/geometry/multi_line_string.hpp \
include/mapbox/geometry/envelope.hpp \
include/mapbox/geometry/multi_point.hpp \
include/mapbox/feature.hpp \
include/mapbox/geometry_io.hpp \
include/mapbox/geometry.hpp

all: @WAGYU_LIB@

@WAGYU_LIB@: $(WAGYU_OBJS)
ar rs @WAGYU_LIB@ $(WAGYU_OBJS)

$(WAGYU_OBJS): %.o: %.cpp ../../liblwgeom/liblwgeom.h $(WAGYU_HEADERS)
$(CXX) $(CXXFLAGS) -c -o $@ $<

../../liblwgeom/liblwgeom.h:
$(MAKE) -C ../../liblwgeom liblwgeom.h

clean:
rm -f @WAGYU_LIB@ $(WAGYU_OBJS)

distclean: clean
rm -f Makefile


install:

uninstall:

check:

.PHONY: clean distclean install uninstall check
Loading