Mapping

Revisi per 1 April 2015 14.02 oleh Angus (bicara | kontrib) (Created page with "=Mapping= The mapping system allows administrators to define new map-based reports rapidly through the interface, and for them to be viewed on-line. ==Defining a new map== Ma...")
(beda) ← Revisi sebelumnya | Revisi terkini (beda) | Revisi selanjutnya → (beda)

Mapping

The mapping system allows administrators to define new map-based reports rapidly through the interface, and for them to be viewed on-line.

Defining a new map

Maps are defined in the same way as other reports, using the Administration | Reports menu. There are two key differences compared to other reports: requirements for the SQL data definition, and style information (Mapfile code)

SQL

The SQL is similar to all other reports, and should be a single SELECT query. However, there are several particular requirements

Required fields

Every query must return two required fields:

  • gid - this is a 'geographic ID' and is a unique integer for each spatial unit returned. Often, this can just be the id from the locations table, but if there can be multiple reports per location, you need to choose another unique ID value. It doesn't matter which. If nothing else is available, you can also use the row number window function:
select row_number() over () as gid, 
  • the_geom: this is the spatial data and must be included in every report. It should always come from the projected version of the locations table spatial data. That is:
    • For polygon data (administrative units) this should be geom_proj (e.g. select geom_proj as the_geom, )
    • For point data (village locations etc) this should be centroid_proj (e.g. select centroid_proj as the_geom, )

Don't use the standard geom and centroid columns, or the data will not be in the right projection and won't appear on the map.

Field names

Any fields generated in the query will be available to the user with a map query (where they click on a feature, and further information pops up). So that this feature works nicely, you should include all the data that a user might want to see, and name each field with a user-friendly name. For example

SELECT
  sum(total) as "Julah hewan"

Mapfile code

Viewing maps

Menu root