This 3-part mini-course is my attempt to explain the basic concepts of working with PostGIS data from within the Leaflet.js mapping API. Technically this is not Leaflet programming. In this scenario Leaflet.js simply becomes the canvas on which your geospatial data is displayed on a web map. All of the interaction with the geospatial data occur through very common and standard methods of working with enterprise level databases, but with a geospatial twist.
Because we are simply submitting SQL statements to a PostGIS database we can do anything from the web that we can do with PostGIS. We can use SELECT statements to retrieve data. We can use INSERT, UPDATE, and DELETE statements to create new data, modify existing data, or delete data. Most importantly we can use the entire suite of PostGIS functions for working spatial data (over 1000 of them) to perform spatial analysis on the data such as buffering, intersections, testing spatial relationships, etc.
The first video in this series explains the relationship between geospatial data stored in PostGIS as tables with rows and columns and geospatial data stored as GeoJSON with feature collections, features, and properties. The second video explains how PHP is used to convert database data to GeoJSON so that it can be displayed in Leaflet. The third video explains the process for submitting an AJAX request from the client to the database and handling the response.
These three lectures are part of an 80 lecture course that will be available on Udemy.com in early July 2018. They cover the core concepts that are needed for interacting with PostGIS data from within Leaflet. I am making these lectures available for free so that self-starters with a solid grounding in basic web technologies can apply it immediately. If you are newer to these technologies there will be much more explanation available in the full course. That course does have two prerequisites. Display and Analyze GIS data on the web with Leaflet and PHP registration, login, and content management system. Both of those prerequisites (and all of my other courses) are available now through the end of July for only $15 with the coupon code JULYSALE, so you can get started with the prerequisites now if needed.