nicheRS
Where could a species live, and how far can we trust the answer? Species distribution models for ecological consultancies.
The question
Where in this area are the conditions this species likes, and how far can we trust the answer?
An example: an environmental consultancy has to assess the impact of a wind farm in Brittany. It needs to know where the western green lizard might live, even though nobody has looked for it in every field. There is no time or money to walk every square kilometre. So it uses a species distribution model: from the places where the species has been seen and the climate of the whole area, the model estimates which other places have similar conditions.
nicheRS is a web application that does this from start to finish. It is meant for people who work with species but are not modelling specialists.
The niche: where conditions suit a species
Each species tolerates a range of conditions: temperature, rainfall, seasons, altitude, vegetation. The holm oak copes with hot, dry summers, and the beech needs moisture. That set of conditions is the species' ecological niche. Hence the name: niche + RS, for Rust, the language it is written in.
The idea is simple: look at the conditions where the species has been seen, and search the map for similar places. The hard part is that sightings tell you where people have looked, not where the species lives:
- There is much more data near cities, roads and nature reserves than in the wild.
- An area with no sightings may have no species… or no visitors.
- There are mistakes: garden plants, zoo animals, wrong coordinates.
How it works, step by step
- Species and area. You pick a species and draw the study area on the map.
- Sightings. They are downloaded from GBIF, the world's largest biodiversity database, and cleaned with fixed rules. The tool always shows how many records it removes and why.
- Climate. Each square kilometre is described with CHELSA climate data: temperature, rainfall and how they change over the year. CHELSA was chosen over the better-known WorldClim because it is in the public domain and can be used in paid work.
- Comparison. The cells with the species are compared with 10,000 random cells from the area.
- Model. 25 model settings are tried and one is chosen with fixed rules, not by eye.
- Result. You get a suitability map, an area of suitable conditions and an evidence level with its reasons.
MaxEnt, rewritten with a magnifying glass
The most widely used method for this is called MaxEnt. Its logic is cautious: of all the ways of spreading the species across the map that fit what has been observed, it picks the one that assumes the least. The reference program, maxent.jar, is written in Java, is free and has not changed since 2020. Ecologists trust it, but it is hard to build into a web service.
So I rewrote it in Rust, with one strict condition: it had to give exactly the same results as the original. Not similar results, the same. That means copying even the program's internal quirks, such as the order in which it adds numbers or how it breaks ties, because MaxEnt stops before the mathematical optimum and only by following its exact path do you end up in the same place.
The result: 16 out of 16 test cases identical, including five real species, with differences of 0.00000000005. Everything fits in a single executable, with no Java, Python or R. A study of one species over the whole of France takes seconds.
How far can we trust it?
A pretty map is not a reliable map. That is why nicheRS sets an exam. It hides whole regions, trains the model on the rest and checks whether it gets the hidden part right. From those marks it gives an evidence level: Insufficient, Exploratory, Indicative or Supported, and Validated when there is independent field data. It never gives a made-up percentage. Nor does it promise where the species is: it speaks of relative suitability, from 0 to 1, and gives the suitable area as a range.
The holm oak in Provence is a good example of why the exam matters. The map looks convincing: the oak grows on the coast and in the hills, not in the Alps. But the model has learnt only one rule, “not too cold”, because mean annual temperature explains 99.9% of the result. Below the mountains the oak is almost everywhere, and climate at 1 km cannot tell where it is more or less likely. The tool says so plainly: Exploratory.
Across the whole of France, where the contrast between Mediterranean and Atlantic climates is stronger, the same species comes out Supported. Scale matters, and it is better for the tool to say so before a report relies on that map.
What ten real species taught us
Ten species were modelled across mainland France, using climate only:
| Species | Level |
|---|---|
| Holm oak, red squirrel, stag beetle | Supported |
| Beech, spiny toad, agile frog | Indicative |
| Fire salamander, hedgehog, asp viper, western green lizard | Exploratory |
Species with a clear climatic niche do well. Generalists such as the hedgehog or the viper, which live almost everywhere in France, do not. They need other variables, such as terrain or vegetation, or field data. That is the honest answer, not a failure.
Who it is for, and where it stands
nicheRS is designed for environmental consultancies that prepare impact assessments and need maps they can defend, with every decision recorded: what was removed, what was chosen and why. That trail lets an ecologist review the study and anyone repeat it.
The core version is finished. On top of it there is a set of expert options (“Science v1”):
- correction for observation bias
- terrain, vegetation and water
- a second method (Random Forest)
- projections under future climate
- the organisation's own field data, with independent validation
These options are off by default. Before they are used in a client report, the ecologists at Natural Solutions have to review them and test them on species they know well.
The code is open source, under the MIT licence.