Git Product home page Git Product logo

utile_comme_du_pq's Introduction

Utile Comme du PQ

This used to be a small repo with few files I needed to grab(yeah for french reader I created it when people were hoarding toilette papers...) but I guess now it is more about checking polygons geometries! The goal is to make a small shiny app that help myself (and maybe other see here) understand how various algorithms and their implementations are used to correct non valid geometries.

The source of inspirations started with this great post from Paul Ramsey (see here and here) about a new implementation of MakeValid() in postGIS.

I tried to reproduce some of this post with R in erreur_topo.R but some are still missing.

What is a valid polygons ?

First I should clarified what is a valid polygons:

Polygons have the concept of validity. The rings of a valid polygon may only intersect at distinct points -- rings can't overlap, and they can't share a common boundary. A polygon whose inner rings partly lie outside its exterior ring is also invalid (p.38 PosGIS in Action)

This is specified by the Simple Features set of standard

List of tools that can be used

Tools inplemeted to correct geometries

sf::st_buffer(x, m)

A great way of "cleaning some mess" but sometimes it feels like we are hammering stuff!

Both have implementation of GEOS but {sf} can also use s2. The engine use in {sf} depend of your version of GEOS (currently mine is 3.10) and if you are using planar or spherical geometry.

Both implementation have the option to provide you with more insight (see reasons in st_make_valid and messages in makeValid()).

Github: https://github.com/baddstats/polyclip

It use clipper v1 now but maybe v2 at one point.

Implementation in {spatstat} is in the owin function:

polyclip works on closed polygon and take as input a list of x and y but the last vertex should not repeat the first (as in simple feature standard). It can also take a list of list for several polygons (see: ?polyclip::polyclip). Polygon B is created in the spatstat.geom::owin as a larger rectangle.

My implementation seems not to be perfect as converting to polyclip object to sf's class maybe bring some errors.

Automatically repair broken GIS polygons using constrained triangulation and returns back a valid polygon.

it can be find here or here

More about here the algorythm in this publication: Ledoux, H., Arroyo Ohori, K., and Meijers, M. (2014). A triangulation-based approach to automatically repair GIS polygons. Computers & Geosciences 66:121–131.

References:

1 Leo S., et Regina Obe. 2021. PostGIS in Action, Third Edition. Simon and Schuster.
2 https://en.wikipedia.org/wiki/Simple_Features
3 Hijmans R (2022). terra: Spatial Data Analysis. R package version 1.6-17, https://CRAN.R-project.org/package=terra.
4 Pebesma, E., 2018. Simple Features for R: Standardized Support for Spatial Vector Data. The R Journal 10 (1), 439-446, https://doi.org/10.32614/RJ-2018-009
5 Johnson A, Baddeley A (2019). polyclip: Polygon Clipping. R package version 1.10-0, https://CRAN.R-project.org/package=polyclip.
6 Dicko A (2020). prepr: Automatic Repair of Single Polygons. R package version 0.1.9000, https://gitlab.com/dickoa/prepr.

utile_comme_du_pq's People

Contributors

defuneste avatar

Stargazers

 avatar Nicolas Mondon avatar Anand Dubey avatar Stephan Hügel avatar Pukar Bhandari avatar Alexander avatar Jack avatar  avatar Chris Toney avatar Majid Hojati avatar Michael Sumner avatar

Watchers

James Cloos avatar Alexander avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.