Coder Social home page Coder Social logo

find_municipalities_near_a_river's Introduction

Find municipalities within some distance from a river

Constantino Carreto Dec 26, 2022

In this project, I use spatial-analysis techniques to find the municipalities whose centroid is 10 km or less from a river, in Mexico. This could be of interest if, for instance, we want to find the municipalities that could be affected the most by floods or exposed to diseases transmitted by mosquitoes. I try to exemplify some spatial techniques and the previous data preparation to be able to implement this spatial analysis. This example can be easily extended to other spatial techniques. I use only a pair of functions of the sf package, but this package has many available functions.

First, I compute municipalities' centroids:

Markdown Monster icon

On the other hand, in the case of the rivers, this is what a simple map looks like: Markdown Monster icon

Then, I compute a buffer of 10 km for the rivers in Mexico, that is, I make the rivers "thicker" by 10 km to the left and 10 km to the right:

Markdown Monster icon

Finally, I localize the municipalities whose centroid is within 10 km or less from a river. I do this by a spatial intersection between the centroids and the rivers' buffers:

Markdown Monster icon

This is a close-up of the state of Chiapas:

Markdown Monster icon

To find the municipalities that are crossed by a river I could have simply intersected the municipalities' polygons and the rivers' buffers, but I added the centroid component to exemplify its computation. Besides, by using the centroids, we could guarantee that the rivers' buffers crossed a great proportion of the municipality, just in case we are interested in finding municipalities with greater exposition to the rivers.

find_municipalities_near_a_river's People

Contributors

constantino-carreto-romero avatar

Watchers

 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.