How to protect national territory and its biodiversity with Artificial Intelligence

Written by
Javier Preciozzi
Published on
March 12, 2024

By: MSc Francisco Piriz, R&D Engineer at Digital Sense, in collaboration with PhD Javier Preciozzi, managing partner at Digital Sense.

A Context of Opportunity

Uruguay is part of Digital Nations, where, among 10 other countries around the globe (such as Israel, Korea, New Zealand, and England), it is leading the change of public management through the adoption of digital technology.

In a quest to improve citizen services, the transition towards a digital government administration is key. In this regard, from Digital Sense, we have been driving part of this change, training 29 public entities in Artificial Intelligence together with AGESIC (E-Government and Information Society Agency) in the last year alone.

A Clear Challenge

In this sense, a field with potential for development is the care and safeguarding of our natural resources, one of the main challenges facing nations today. In Uruguay, as elsewhere in the world, the indiscriminate use and illegal extraction of natural resources have been detected. This represents a serious problem for the conservation of the biodiversity of the territory, its waters, and surrounding soils.

Recently, the case of private companies that diverted a natural watercourse located in the Santa Lucía river basin without authorization to facilitate the extraction of raw material for their own benefit became public knowledge. This action, in addition to potentially impacting the water source that supplies 60% of the country’s population¹, could negatively affect the ecological balance and biodiversity of the territory.

At present, in Uruguay, the monitoring of internal waters is carried out by naval Prefecture personnel who, from time to time, circulate in boats along streams and rivers. The main disadvantage of this type of monitoring, apart from the high costs of these campaigns, is the time involved, which in general does not allow for early detection of incidents, with the great inconvenience that this entails.

The aim of this research

At Digital Sense, we combine our machine learning, remote sensing, and image processing expertise to provide crop monitoring and precision agriculture services.

In the case of watercourse diversion in the Santa Lucía river basin, the processing and analysis of satellite imagery allow us to answer several questions, which we address in this study:

The existence or not of an artificial diversion (by human intervention) of the watercourse;

If it has occurred, to determine on which dates the intervention began;

Quantifying how significant the artificial diversion was compared to the natural variations of the watercourse over time.

The possibility of detecting such diversions automatically, eventually triggering an alarm that allows rapid action and enables the State to save costs and public management time.


To evaluate and test the potential of monitoring using free available satellite imagery, we developed an algorithm capable of tracking the course of the watercourse under inspection and detecting changes in its course over time.

The first observation we made was applying Google Earth. The last two photos available on the site of the river in question date from February 2018 and March 2022:

Images below, extracted from Google Earth:

In the image on the right, corresponding to March 2022, a modification of the river's course can be observed.

A comparison of the land on dates: February 2018 and March 2022

Unlike other images, Google Earth images cannot be downloaded for free, which is necessary for automatic processing. These images, which prove at least one change in the last four years, motivate us to automate the detection of these evolutions. This is what we will describe hereafter.

The key: Data

To work with satellite images, we first have to determine which images we have available and which are the most suitable for our purpose, taking into account that we start from the assumption of using open-access images.

There are several satellites that make their images available. These images range from optical images (in visible light frequencies) to images that acquire other bands of the electromagnetic spectrum, such as infrared (which provides thermal information) or near-infrared (NIR, for Near Infra Red). These are useful for vegetation monitoring, among others. Earth observation satellites also convey different instruments, such as radar and derivatives, depending on the purpose for which they were placed in orbit.

Another key factor is the spatial and temporal resolution of these observations. The spatial resolution can range from the order of a meter (or less) to kilometers, depending on the phenomena to be observed. In the same way, we have satellites (or constellations of satellites) that revisit the same place more than once a day and others with which we have no more than one monthly observation.

This study is a brief proof of concept, which does not constitute an exhaustive analysis of the methodology or the type of optimal data to be used. The goal is to illustrate the feasibility of this type of procedure. For this purpose, we use data from the Sentinel-2 satellite of the European Space Agency (ESA).

Sentinel-2 is a constellation of Earth observation satellites operated by ESA. These satellites provide high-resolution images of the Earth’s surface for applications in agriculture, disaster management, natural resource management, and environmental monitoring. Equipped with high-resolution multispectral cameras, they can capture images of the Earth’s surface at different wavelengths.

In this case, we rely on the spectral bands that make up the visible spectrum: red, green, and blue (RGB). We also use the NIR band, which reflects the earth’s response to an incident wave of near-infrared wavelengths. These bands have a spatial resolution of 10 meters. Satellites of the Sentinel-2 constellation fly over our study region approximately once a week.

How can we exploit and valorize this data?

By combining these bands in a specific way, we can expose phenomena or artifacts that would not be observable to the human eye. In this case, we calculate an index called NDWI (Normalized Difference Water Index), obtained from the combination of the green and NIR bands.

NDWI = (Green — NIR) / (Green + NIR).

As the name implies, this combination tends to highlight the presence of water on the surface. To illustrate the potential of NDWI in this case, we show below two RGB images from September 2020 and September 2021 and the corresponding NDWI images.

Source: Sentinel-2

Source: Sentinel-2

In these images, the presence of the watercourse can be seen in bright yellow. They clearly illustrate the potential of NDWI to detect and segment the watercourse at any date and to identify the moments when there were important modifications, if any.

For this purpose, we took images every one to two months from March 2020 to the end of 2022, discarding the ones with strong cloud cover to identify deviations in the watercourse. With the NDWI images and image processing based on basic statistical tools and mathematical morphology, we obtain a follow-up of the river throughout this period.

→ RGB images:

→ NDWI images:

→ RGB imaging with automated basin detection:

In these sequences, it can be identified that there was an alteration in the riverbed starting between December 2020 and January 2021. In particular, an islet of sand can be observed that moved from the left bank to the right bank of the river.

Throughout this evolution, we can identify four periods:

  • March 2020 — December 2020: changes are not significant, responding to natural factors (floods, etc.);
  • December 2020 — January 2021: the new course of the river is observed for the first time, and how the previous passage is closed;
  • January 2021 — February 2021: these transformations are accentuated and the new river passage thickens.
  • From February 2021: the river remains relatively stable, and its old branch dries up progressively.

These four periods are shown in the images below, making the difference between the course of the river at the beginning of each period and the end of it. The blue areas represent the areas where the river disappeared during that period, and the yellow areas represent the areas where the river invaded during that period.

With the above-mentioned tools, we were able to highlight changes, mainly between December 2020 and February 2021, where the yellow arm indicates the new path of the river and the blue part indicates the closed section.

There are several possible ways to quantify these observations. One simple way we use here for illustration purposes is to plot, as a function of time, the surface area (in hectares) that goes from being part of the riverbed to not being so and vice versa (the sum of the yellow and blue painted areas in the previous figure). We can clearly see a significant peak occurring between late 2020 and early 2021.

Observed area alterations

The evolution of this change, which reflects the period of greatest impact on the river, gives us hints to study the statistical behavior of rivers and later automate change detection and other anomalous behaviors.


Today it is possible to monitor an entire national territory to protect natural resources remotely. Automatic change detection algorithms can send early notifications whenever something or someone generates changes in any geographic region.

A team of experts in satellite imagery from Digital Sense developed and validated this solution as a proof of concept.

The previously stated case that showed how private companies have illegally altered national waters and soil may not be an isolated case. It is clear evidence of the relevance of advanced digital technologies in public management. Part of the solution lies in understanding the scope and positive impact that Artificial Intelligence can generate and being open to change. In the end, it is our continuous change that has characterized and made us move forward as a global citizenry.