PGSQLMapContextConfig
The PGSQLMapContextConfig config driver use the
MapContext configuration model to store the GeoPrisma
configuration inside a PostgreSQL database.
- Please, be sure to have read these topics before continuing :
-
Geoprisma setting
To tell GeoPrisma to use this config :
<?php
org_geoprisma_SettingImpl::setConfig('org_geoprisma_config_PGSQLMapContextConfig');
?>
Driver extra parameters (mandatory)
Connection to the database
This driver needs the connection informations to the PostgreSQL database :
<?php
$szConnection = 'host=localhost dbname=mcconfig user=demo password=demo port=5432';
org_geoprisma_config_PGSQLMapContextConfig::setConnectionString($szConnection);
?>
MapContext + Application ) OR ( Session )
This driver also needs to know which MapContext and
which Application to use. You can either manually
define a MapContext + Application pair using the following ‘set’ methods.
Using their id stored in the DB :
<?php
org_geoprisma_config_PGSQLMapContextConfig::setCurrentMapContext(1);
org_geoprisma_config_PGSQLMapContextConfig::setCurrentApplication(1);
?>
or their name :
<?php
org_geoprisma_config_PGSQLMapContextConfig::setCurrentMapContextName("MyMapContext");
org_geoprisma_config_PGSQLMapContextConfig::setCurrentApplicationName("MyApplication");
?>
Alternatively, you can specify a Session instead.
Using its id :
<?php
org_geoprisma_config_PGSQLMapContextConfig::setCurrentSession(1);
?>
or its name :
<?php
org_geoprisma_config_PGSQLMapContextConfig::setCurrentSessionName("MySession");
?>
Database table names
The table names follow these construction rules :
type |
construction rule |
full table name example |
feature
table |
Prefix +
Feature name |
mcconfig_resource |
option
table |
Prefix +
Feature name +
Option suffix |
mcconfig_resourceoption |
relation
table |
Prefix +
Master feature name +
Slave feature name |
mcconfig_mapcontextresource |
relation
option
table |
Prefix +
Master feature name +
Slave feature name +
Option suffix |
mcconfig_mapcontextresourceoption |
Resource options
As explained in this topic
(MapContext configuration model), Widgets are linked to
Resources if it has the Resource option required by the Widget.
Learn more about Resource options in the following topics :
Field options
Resource options can be used as a way
to link Widgets to Resources and so do Field options.
Learn more about Field options in the following topics :
OpenLayers.Layer object creation logic
Since the Map widget no longer exists in the
MapContext configuration model, there are no longer
Layer tags to define the OpenLayers.Layer objects to create. Instead, the
Resource options are used when creating OpenLayers.Layer object as options.
However, OpenLayers.Layer objects are not always created and added to the
Map for a specific Resource. For each of its DataStores, we first check
its Service type, then we check the according rule before adding a layer
object. Here’s how it works :
service type |
creation rule |
GYMO |
always added |
Tilecache |
always added |
WMS |
only added if there is no TileCache or TMS layer already
added (of the same resource) |
FeatureServer
(vector) |
only added if a Widget (using the ‘featureserver’
servicetype) needs the layer to work with it OR if it’s
the only DataStore available, i.e. if no widget need
a featureserver layer but it’s the only DataStore
available for the resource, a layer will be added. |
WFS (vector) |
Same rules as FeatureServer |
TMS |
always added |
Note
The above creation rules apply only for this config driver.
Note
To know wheter or not a Widget needs a layer to interact with, we
use the Widget needLayer method defined inside its .php file.
Config_secur.xml
This driver also creates a config_secur.xml file as the other config driver do.
That way, the same templating system (XSLT) is preserved. Some new nodes were
added, such as Resource options and Resource fields, but they don’t break
anything with the original configs.