Skip to content

Commit

Permalink
Fix poly make_valid query
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Oct 1, 2021
1 parent 362c1fc commit 7a3ef68
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ jobs:
yum install openssl-devel -y
yum install epel-release -y
yum install --enablerepo=powertools gdal-devel -y
# RH UBI image registry.access.redhat.com/ubi8/ubi
# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# yum install --enablerepo=ubi-8-codeready-builder gdal-devel
- name: Build & package
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

* Fix reading 2D types from PostGIS geometries with Z or ZM dimensions
* Fix CORS headers (thanks @tobwen)
* Fix invalid geometries for some polygon simplifications

## 0.14.0 (2021-08-27)

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "t-rex"
version = "0.14.1-pre8"
version = "0.14.1-pre9"
description = "t-rex vector tile server"
repository = "https://github.com/t-rex-tileserver/t-rex"
readme = "README.md"
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ t-rex is written in [Rust](https://www.rust-lang.org/). Minimal required rustc v

### Software Requirements

#### Ubuntu 20.04 (Focal Fossa)
Ubuntu 20.04 (Focal Fossa):

sudo apt install cargo libssl-dev libgdal-dev
sudo apt install cargo libssl-dev libgdal-dev


### Building T-Rex
### Build and raun

Build:

Expand Down
2 changes: 1 addition & 1 deletion t-rex-core/src/datasource/postgis_ds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl PostgisDatasource {
"POLYGON" | "MULTIPOLYGON" | "CURVEPOLYGON" => {
if layer.make_valid {
format!(
"ST_CollectionExtract(ST_Multi(ST_MakeValid(ST_SnapToGrid({}, {})),3)::geometry(MULTIPOLYGON,{})",
"ST_CollectionExtract(ST_Multi(ST_MakeValid(ST_SnapToGrid({}, {}))),3)::geometry(MULTIPOLYGON,{})",
geom_expr,
layer.tolerance(zoom),
layer_srid
Expand Down
2 changes: 1 addition & 1 deletion t-rex-core/src/datasource/postgis_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn test_feature_query() {
"SELECT COALESCE(ST_SnapToGrid(ST_Multi(geometry), $5::FLOAT8/2),ST_GeomFromText('MULTIPOLYGON EMPTY',3857))::geometry(MULTIPOLYGON,3857) AS geometry FROM osm_place_point WHERE geometry && ST_MakeEnvelope($1,$2,$3,$4,3857)");
layer.make_valid = true;
assert_eq!(pg.build_query(&layer, 3857, 10, None).unwrap().sql,
"SELECT ST_CollectionExtract(ST_Multi(ST_MakeValid(ST_SnapToGrid(ST_Multi(geometry), $5::FLOAT8/2)),3)::geometry(MULTIPOLYGON,3857) AS geometry FROM osm_place_point WHERE geometry && ST_MakeEnvelope($1,$2,$3,$4,3857)");
"SELECT ST_CollectionExtract(ST_Multi(ST_MakeValid(ST_SnapToGrid(ST_Multi(geometry), $5::FLOAT8/2))),3)::geometry(MULTIPOLYGON,3857) AS geometry FROM osm_place_point WHERE geometry && ST_MakeEnvelope($1,$2,$3,$4,3857)");
layer.geometry_type = Some("LINESTRING".to_string());
assert_eq!(pg.build_query(&layer, 3857, 10, None).unwrap().sql,
"SELECT ST_Multi(ST_SimplifyPreserveTopology(ST_Multi(geometry),$5::FLOAT8/2)) AS geometry FROM osm_place_point WHERE geometry && ST_MakeEnvelope($1,$2,$3,$4,3857)");
Expand Down

0 comments on commit 7a3ef68

Please sign in to comment.