ABSTRACT

This chapter integrates a plant observations web map with spatial SQL queries to selectively load data from the CARTO database, based on geographical proximity. Specifically, it builds a web map where the user can click on any location, and as a result the nearest plants observations to the clicked location will be loaded from the database and displayed, along with straight-line paths towards those plants. The steps for building the web map include: adding a marker at the clicked location on the map; adding a custom marker at clicked location, to distinguish it from the observation markers; finding nearest features, using a spatial SQL query, and adding them on the map; and drawing line segments from clicked location to the nearest features.