Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoledoux committed Jul 17, 2024
2 parents 07b1c3c + e54816f commit 5350e48
Show file tree
Hide file tree
Showing 203 changed files with 31,746 additions and 4,103 deletions.
16 changes: 6 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ if(COMMAND cmake_policy)
cmake_policy(SET CMP0011 NEW)
endif(COMMAND cmake_policy)

cmake_minimum_required (VERSION 3.16)
project( val3dity )

cmake_minimum_required (VERSION 3.16)


add_definitions(-std=c++14)
Expand Down Expand Up @@ -51,9 +51,7 @@ if ( NOT Boost_FOUND )
endif()

# GEOS
find_package( GEOS REQUIRED CONFIG)
# if linux complains:
# find_package( GEOS )
find_package( GEOS REQUIRED )
if ( NOT GEOS_FOUND )
message(SEND_ERROR "val3dity requires the GEOS library")
endif()
Expand All @@ -62,16 +60,16 @@ include_directories( ${GEOS_INCLUDE_DIR} )
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty )

FILE(GLOB_RECURSE THIRDPARTY thirdparty/*.cpp)
add_library(thirdparty STATIC ${THIRDPARTY})
add_library(val3dity_thirdparty STATIC ${THIRDPARTY})

FILE(GLOB SRC_FILES src/*.cpp)

if ( LIBRARY )
if ( VAL3DITY_LIBRARY )
message(STATUS "Building val3dity library")
list(REMOVE_ITEM SRC_FILES src/main.cpp)
add_library(val3dity STATIC ${SRC_FILES})
target_include_directories(val3dity PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
set_property(TARGET thirdparty PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET val3dity_thirdparty PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET val3dity PROPERTY POSITION_INDEPENDENT_CODE ON)
else()
message(STATUS "Building val3dity executable")
Expand All @@ -80,8 +78,6 @@ else()
endif()


target_link_libraries(val3dity CGAL::CGAL CGAL::Eigen3_support GEOS::geos_c thirdparty Boost::filesystem)
# if linux complains:
# target_link_libraries(val3dity CGAL::CGAL CGAL::Eigen3_support ${GEOS_LIBRARY} thirdparty Boost::filesystem)
target_link_libraries(val3dity CGAL::CGAL CGAL::Eigen3_support ${GEOS_LIBRARY} val3dity_thirdparty Boost::filesystem)

install(TARGETS val3dity DESTINATION bin)
115 changes: 0 additions & 115 deletions Dockerfile

This file was deleted.

69 changes: 35 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# val3dity

val3dity---pronounced 'val-three-dity'---allows us to validate 3D primitives according to the international standard ISO19107.
Think of it as [PostGIS ST_IsValid](http://postgis.net/docs/ST_IsValid.html), but for 3D primitives (PostGIS only validates 2D primitives).
Think of it as [PostGIS ST_IsValid](http://postgis.net/docs/ST_IsValid.html), but for 3D primitives.

In short, it verifies whether a 3D primitive respects the definition as given in [ISO19107](http://www.iso.org/iso/catalogue_detail.htm?csnumber=26012) and [GML](https://en.wikipedia.org/wiki/Geography_Markup_Language).
In short, it verifies whether a 3D primitive respects the definition as given in [ISO19107](https://www.iso.org/standard/66175.html).

The validation of the following 3D primitives is fully supported:

Expand All @@ -17,13 +17,14 @@ The validation of the following 3D primitives is fully supported:
- ``CompositeSolid``

Unlike many other validation tools in 3D GIS, inner rings in polygons/surfaces are supported and so are cavities in solids (also called voids or inner shells).

However, as is the case for many formats used in practice, only planar and linear primitives are allowed: no curves or spheres or other parametrically-modelled primitives are supported.
There is no plan to support these geometries.

val3dity accepts as input:

- [CityJSON](http://www.cityjson.org)
- [CityJSON Lines (CityJSONL)](https://www.cityjson.org/specs/#text-sequences-and-streaming-with-cityjsonfeature)
- [CityJSON Sequences (CityJSONSeq)](https://www.cityjson.org/cityjsonseq/)
- [tu3djson](https://github.com/tudelft3d/tu3djson)
- [JSON-FG (OGC Features and Geometries JSON)](https://github.com/opengeospatial/ogc-feat-geo-json)
- [OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
Expand All @@ -33,22 +34,6 @@ val3dity accepts as input:
For the CityJSON and IndoorGML formats, extra validations are performed (specific to the format), eg the overlap between different parts of a building, or the validation of the navigation graph in IndoorGML.


## Usage

val3dity is a command-line interface (CLI) programme only, with [several options](https://val3dity.readthedocs.io/en/latest/usage/#options-for-the-validation).

[![val3dity cli demo](./misc/cli.svg)](https://asciinema.org/a/329835)
_No demo visible here? View it on [asciinema](https://asciinema.org/a/329835)._


## Web application

If you don't want to go through the troubles of compiling and/or installing val3dity, we suggest you use the [web application](http://geovalidation.bk.tudelft.nl/val3dity).
Simply upload your file to our server and get a validation report back.
We delete the file as soon as it has been validated (promised!).
However, a file is limited to 50MB.


## Installation of the command-line tool

### macOS
Expand Down Expand Up @@ -81,7 +66,7 @@ and then
$ make


### linux
### Linux

Under Linux (at least Ubuntu), CGAL has to be compiled because apt-get doesn't give you a version with Eigen.
Thus, in a nutshell,
Expand All @@ -98,45 +83,52 @@ Thus, in a nutshell,
For Windows, we offer [an executable](https://github.com/tudelft3d/val3dity/releases).

It's also possible to compile val3dity yourself with the CMake file we offer, but it's slightly more complex with the dependencies.
We suggest you look at [how we build it on GitHub Actions](https://github.com/tudelft3d/val3dity/blob/main/.github/workflows/build_exe.yml) to get some inspirate (and help).
We suggest you look at [how we build it on GitHub Actions](https://github.com/tudelft3d/val3dity/blob/main/.github/workflows/build_exe.yml) to get some inspiration (and help).


## Usage

To compile and run val3dity (from the val3dity folder):
To run val3dity:

$ ./val3dity /data/cityjson/cube.json
val3dity ./data/cityjson/cube.json

The summary of the validation is reported, and you should see that `cube.json` contains one valid primitive.

Finally, to see all the options possible:

$ ./val3dity --help
val3dity --help

To validate a [CityJSONSeq stream](https://www.cityjson.org/cityjsonseq/), you need to pipe the stream into val3dity and use ``stdin`` for the input.
If you have a CityJSONSeq serialised in a file, then you can cat it:

## Using val3dity as a library
cat myfile.city.jsonl | val3dity stdin

val3dity can be compiled as a library:
The output shows, line by line, what the errors are.
If the list of error is empty (``[]``) this means the feature is geometrically valid 🎉

$ cmake .. -DLIBRARY=true

There is a simple example in `./demo_lib` with instructions to compile it.
## Using val3dity as a library

val3dity can be compiled and used as a library:

## Unit tests
cmake .. -DVAL3DITY_LIBRARY=true

There is a simple example in `./demo_lib` with instructions to compile it.

To verify that everything went fine during the compilation, run the unit tests (from the root folder of val3dity) (this requires `pip install pytest pyyaml`):

$ python -m pytest --runfull
## Web application

You shouldn't get any errors.
If you don't want to go through the troubles of compiling and/or installing val3dity, we suggest you use the [web application](http://geovalidation.bk.tudelft.nl/val3dity).
Simply upload your file to our server and get a validation report back.
We delete the file as soon as it has been validated (promised!).
However, a file is limited to 50MB.


## Simple visualiser for the errors: viz3dity

![](./tools/viz3dity/screenshot.png)

In the folder `tools/viz3dity/`, there is a simple Python script where you load a CityJSON file with geometries and one with the val3dity report, and you can see which objects have specific errors (each error gets a colour).
In the folder `tools/viz3dity/`, there is a simple Python script where you can load a CityJSON file with geometries and one with the val3dity report, and you can see which objects have specific errors (each error gets a colour).

However, it's not possible to see where in an object the error is (eg which surface is not planar).
This tool helps to quickly visualise where the errors are in a large dataset, for instance a city.
Expand All @@ -151,7 +143,16 @@ If you have a question or came across a bug, please submit an issue there.
However we ask you check first whether your problem has already been solved by someone else.


## If you use val3dity in a scientific context, please cite these articles:
## Unit tests

To verify that everything went fine during the compilation, run the unit tests (from the root folder of val3dity) (this requires `pip install pytest pyyaml`):

python -m pytest --runfull

You shouldn't get any errors, if you do then let us know by opening an issue.


## If you use val3dity in a scientific context, please cite these two articles:

```bibtex
@article{Ledoux18,
Expand Down
2 changes: 1 addition & 1 deletion bumpver.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpver]
current_version = "2.4.0"
current_version = "2.5.0b2"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit = false
tag = false
Expand Down
27 changes: 26 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@

## [Unreleased]
- validation of topological relationships between features, eg ensuring that buildings in a city do not overlap
- support for all GML3 primitives (for IndoorGML): the so-called "Compact Geometries" (http://schemas.opengis.net/gml/3.3/geometryCompact.xsd)


## [2.5.0] -
### Added
- val3dity now accepts a stream of CityJSONSeq as input from stdin: `cat myfile.jsonl | val3dity stdin` and it validates each line and outputs the result to stdout
- a new error was added: error 905--INVALID_JSON for handling wrong JSON lines in a CityJSONSeq stream
### Changed
- the validation report in JSON has been greatly simplified. Now the errors are a flat list of errors and the "id" gives the position of the error in the feature.
- the library/API has a new way to accept parameters for the validation (named parameters), it's more flexible and simpler to use. If you used v2.4 with defaults then nothing needs to be changed, if you passed them then a small change is required.
- the library/API now accepts arrays of points/faces (including with inner-rings) as input
- the library/API does not cout or clog anything anymore, so you can manage your own log without val3dity polluting it
- the val3dity binary doesn't output to clog anymore, instead the logger "spdlog" is used (when `--verbose` is activated) and a few logs are output
- the CMake should now compile directly on macOS/Linux/Windows if GEOS is installed on your machine


## [2.4.0] - 2023-06-27
Expand Down Expand Up @@ -97,3 +109,16 @@
- CompositeSolid, MultiSolid
- CityObjects in the report
- support for CityJSON


[2.5.0]: https://github.com/tudelft3d/val3dity/compare/2.4.0...2.5.0
[2.4.0]: https://github.com/tudelft3d/val3dity/compare/2.3.1...2.4.0
[2.3.1]: https://github.com/tudelft3d/val3dity/compare/2.3.0...2.3.1
[2.3.0]: https://github.com/tudelft3d/val3dity/compare/2.2.0...2.3.0
[2.2.0]: https://github.com/tudelft3d/val3dity/compare/2.1.1...2.2.0
[2.1.1]: https://github.com/tudelft3d/val3dity/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/tudelft3d/val3dity/compare/2.0.4...2.1.0
[2.0.4]: https://github.com/tudelft3d/val3dity/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/tudelft3d/val3dity/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/tudelft3d/val3dity/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/tudelft3d/val3dity/compare/2.0.0...2.0.1
12 changes: 6 additions & 6 deletions cmake/FindGEOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ ELSE(WIN32)

IF (GEOS_CONFIG)

EXEC_PROGRAM(${GEOS_CONFIG}
ARGS --version
EXECUTE_PROCESS(COMMAND ${GEOS_CONFIG}
--version
OUTPUT_VARIABLE GEOS_VERSION)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GEOS_VERSION_MAJOR "${GEOS_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GEOS_VERSION_MINOR "${GEOS_VERSION}")
Expand All @@ -85,8 +85,8 @@ ELSE(WIN32)
ENDIF (GEOS_VERSION_MAJOR LESS 3)

# set INCLUDE_DIR to prefix+include
EXEC_PROGRAM(${GEOS_CONFIG}
ARGS --prefix
EXECUTE_PROCESS(COMMAND ${GEOS_CONFIG}
--prefix
OUTPUT_VARIABLE GEOS_PREFIX)

FIND_PATH(GEOS_INCLUDE_DIR
Expand All @@ -97,8 +97,8 @@ ELSE(WIN32)
)

## extract link dirs for rpath
EXEC_PROGRAM(${GEOS_CONFIG}
ARGS --libs
EXECUTE_PROCESS(COMMAND ${GEOS_CONFIG}
--libs
OUTPUT_VARIABLE GEOS_CONFIG_LIBS )

## split off the link dirs (for rpath)
Expand Down
Loading

0 comments on commit 5350e48

Please sign in to comment.