Geography Reference
In-Depth Information
Adding the Code
Now that we have a good-looking UI, it's time to start adding functionality to our app.
Using the MapBox control is very easy. The concept is simply to create layers, and then add
those layers to the control which will then render and display them.
Each layer can have a different spatial reference and coordinate system, and the map
control can re-project and convert coordinates on the fly. For this example though, we're
going to let Postgres do all the work for us.
Load and run pgAdmin, and log into your database containing the data we loaded earlier.
Expand the object tree until you can see all your tables and other objects.
Figure 76: Object Tree in pgAdmin
As you can see in the figure, beneath the Tables node is a small green icon named Views .
You may have used these before in other databases. The general idea is that they project
data from other tables into a different schema, but appear to client apps as though they were
an actual table.
A typical use is to take rows from different tables linked via foreign keys, and present a
simple flat view of the combined data in which all the present items form a single row rather
than a hierarchy.
For our demo, we are going to re-project our town and city points as WGS84 (SRID 4326) to
match the coordinates of the U.K. counties layer. We'll start by right-clicking on Views and
creating a new view.
 
Search WWH ::




Custom Search