Custom markers to show tree health?

what you’re seeing in your second image is effectively 2 sets of markers rendered 2 different ways. the red markers are delivered from iNat’s servers as tiled images via iNaturalist’s API. the green markers are being rendered by the map itself using coordinates from observation data delivered from iNat. (probably that green set represents the n=30? most recently submitted observations in your project, while the red set should be all observations in the project, assuming they are mappable.)

if you want to create a map like what’s shown in your first image above, you need to start with a set of data that includes coordinates + health status + DBH. if the map can be static, then the easiest way to get that data is via iNaturalist’s standard CSV export. once you have that data, you can use just about any mapping tool to create the map as you like.

if the map needs to be dynamic, displaying new markers as you add new observations in iNaturalist to represent new trees, then you’ll need a way to get your dataset programmatically. since your example is hosted on shinyapps.io, i’ll assume that you’re familiar with R and that that would be your first choice of language to programmatically get your dataset.

the required data will come from iNaturalist API’s /v1/observations endpoint. each GET request from v1/observation can return up to 200 observations. so if your dataset won’t exceed 200 observations, then 1 request should be enough. otherwise, you’ll need to do some sort looping or iteration to get the whole dataset. (note that the iNat API isn’t really designed to give you more than 10,000 observations. so if you need to map more than 10,000 observations for some reason, then you probably need to do it some other way.)

there are lots of ways to get data via the API using R. if you already know what to do here, then great. there are also lots of discussions in the forum about getting data via R. for example: https://forum.inaturalist.org/t/using-r-to-extract-observations-of-a-specific-phenological-state/7007 and https://forum.inaturalist.org/t/inaturalist-visualization-what-introduced-species-are-in-my-place/12889. if you need more help, then say so, and i or someone else can provide more help here.

anyway, once you have your dataset, then just get the values that correspond to coordinates + tree health + DBH, and i assume you’ll be able to plop that in your existing R code to generate a map similar to your example.

not sure if it’ll be directly helpful here for your use case, but back in the day, i wrote a tutorial that describes mapping using the tiled markers: https://forum.inaturalist.org/t/in-pursuit-of-mappiness-part-1/21864. i’ve been meaning to write a follow-up tutorial about other ways of mapping, but i haven’t gotten there yet.

2 Likes