Reference‎ > ‎

Metadata Tables


A map has a set of metadata tables, stored in a SQLite database along the map, that lets you define: symbology and validation rules (please refer to “Importing and Exporting Shapefiles” for more information). The I/O utility provides an interface that makes it easy to work with the metadata, and since the tables are stored as regular SQLite tables, you can also issue standard SQL commands and scripts to operate on them. Please refer to http://www.sqlite.org/about.html for more information on SQLite.

The metadata is stored in the following tables:
  • pcm_table_metadata (data per individual shapefile/table)
  • pcm_field_metadata (data per individual column for each shapefile/table)
Notice column names starting with an underscore “_” are for internal use and should not be modified.

Interacting with the SQLite database

pcMapper lets you interact with the SQLite database of your maps. As you select a table in the tree list, the command issued to the database is shown in the SQL command window. You can change this command by entering your own and clicking the [Execute] button. You can also save and load scripts. The commands can operate on the metadata tables, the feature tables (shapefiles) or any other table in the database. You can even create your own tables!
Figure: PcmSQLite window
  1. Connect your device to a PC and navigate to the pcMapper program folder on the sdcard
  2. Start the I/O utility - PcmSQLite.exe
  3. Select the Show tab
  4. Select the Map to change
  5. Expand the <Map>.db list and select the item to change/view
  6. Enter the desired SQL command and click the [Execute] button
Notice: you may need to refresh the result window by switching away from the Show tab and back again if you make modifications to the database.

pcm_table_metadata

This table has one row for each imported shapefile in the map.
ColumnMeaningValue
_idrow number
_TabNamename of shapefile
_TabIndexprimary key
Namedisplay namestring
ListRow11st record display field_FieldIndex in field_metadata
ListRow22nd record display field_FieldIndex in field_metadata
MapFieldlabeling and info field_FieldIndex in field_metadata
Sheetmap theme identifiernot implemented in Lite yet
SymIdsymbol identifierinteger 0-9
_SymTypefeature type
_FileHeaderfile info


pcm_field_metadata

This table has one row for each column of each shapefile
ColumnMeaningValue
_idrow number
_FkTableforeign key_TabIndex in table_metadata
_FieldIndexprimary key
Namedisplay namestring
Dfltdefault value for new recordsvalue corresponding to Type
Typedata typeINTEGER | FLOAT | TEXT
Minminimum value < (exclusive)number < Max
Maxmaximum value > (exclusive)number > Min
Sizedata input widthnumber > 0
DialogTypeinput behaviorkeyword or SQL clause (see below)
ReadOnlynot editable1=Yes | 0=No (is editable)
Mandatoryvalue requirednot implemented yet


DialogType Keywords:

KeyMeaning
HEIGHTstores height measure in this column (FLOAT). Please refer to “Measuring with Camera” for more information.


DialogType SQL Examples:

Given the following tables:

Tab1
IdNameCategory
1AppleFruit
2OrangeFruit
3CarrotVegetable


The following SQL clause results in:
SQLResult for data input dialog
ENUM 1,2,3Choice: 1 | 2 | 3 (independently of Tab1)
SELECT Name FROM Tab1Choice: Apple | Orange | Carrot
SELECT Name FROM Tab1 ORDER BY NameChoice: Apple | Carrot | Orange
SELECT Name FROM Tab1 WHERE Category = “Fruit”Choice: Apple | Orange
SELECT Id, Name FROM Tab1Choice: Apple | Carrot | Orange
(stored value is 1, 2, or 3 respectively)

Notice: you should not include the trailing semicolon “;” in the metadata cells.
Comments