How Everything Works
I know my data gets stored in a geospatial database - but what is a geospatial database?
Most of what makes up a spatial database is a traditional relational database. Relational databases store information in tables of columns and rows that are related to one another by values in the rows of a common column, or combination of columns, known as key values.
Different spatial database and Geographic Information Systems (GIS) producers use the term "spatial database" in different ways, but typically the term refers to the extension of an existing relational database to store and serve geospatial data. The database behind the Sea Perch service is called PostGIS. PostGIS has the name it does because it is an advanced spatial database that not only stores and serves geospatial data, but is also an environment for manipulation and analysis of geospatial data - a server-based GIS.
Ok, but how does my data get from a log file or web form into the spatial database?
When you enter your data into the web form and/or select a data file for upload and click the submit button, all of the information is passed to the server, where it is processed and written to the database. The data processing is handled by small stand-alone programs called scripts. These scripts take the data and integrate it into a set of database commands used for uploading data.
I use a web form to request graphs and tables. Is a server script used for that?
Yes, though additional sets of scripts are also used. When you request data, the aforementioned set of scripts translates the request to database commands used for extracting data. For data tables, the database simply passes requested data to the server scripts, which translate the database's response to a format readable by web browsers. For graphs, the server scripts send the database commands containing information on the data to be graphed, but the graphs are generated by a statistical software program running separately on the server. Most relational databases have extensions that enable the database to communicate with other software. The Sea Perch database uses an extension called PL/R to send data and graphing commands to the R statistical environment, which generates the graphs and writes them to a web-accessible directory on the server.
The map is also a graphic. Is it generated on the server like graphs are?
Yes and no. The map on the Sea Perch site is a visualization of geospatial data that reside on the server, but the generation and behavior of the map is actually a custom coded part of the web page and is primarily processed by your computer. This code implements instructions contained in a group of scripts called a library that resides on the server, but is uploaded to your computer when you load the web page containing the map. At the very least, the custom code must tell your browser what data to request from the server, how to display the data requested, and what to do when you click, drag, etc. on the map.
How is the mapping library able to communicate with all of the different types of spatial database and related software?
In the recent past, each implementation of spatial database related technology had a client library developed specifically for it. For a myriad of reasons, this approach has largely been abandoned in favor of technological standards that allow service providers and users to choose the client and server technologies that best fit their needs.
While providing flexibility and allowing for greater innovation, the implementation of standards requires that a translation software be used to interpret instructions sent by the client to the server. In general, this type of software is known as "middleware." For geospatial data, the middleware used is map serving software, which is typically a library of scripts that takes the standards-based instructions sent to the sever and interprets them to the language of the operating system and database the server is running. When the database has processed the instructions, the map serving software interprets the results back to the standard format for the client to process and display.