Changes between Version 8 and Version 9 of GeoManual


Ignore:
Timestamp:
18/04/08 17:43:09 (12 years ago)
Author:
ashaon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GeoManual

    v8 v9  
    128128 
    129129 
    130 '''Parameter''' '''Description''' 
    131     dbtype          Type of database. Example: “locationxy” for spatial database. (this has been used for both ECN and MIDAS datasets) 
    132     host            Database host name/ip address 
    133     port            Database port number 
    134     instance        Name of the database schema used. 
    135     user            Username required to access the database 
    136     password        Password associated with the username 
     130'''Parameter''' '''Description'''[[BR]] 
     131 
     132    dbtype          Type of database. Example: “locationxy” for spatial database. (this has been used for both ECN and MIDAS datasets)[[BR]] 
     133 
     134    host            Database host name/ip address [[BR]] 
     135    port            Database port number [[BR]] 
     136    instance        Name of the database schema used. [[BR]] 
     137    user            Username required to access the database [[BR]] 
     138    password        Password associated with the username [[BR]] 
    137139    driver          JDBC driver required to establish connection to the database used. Example: org.geotools.data.geometryless.wrapper.PGConnectionPool  
    138                     (postGreSQL), oracle.jdbc.pool.OracleConnectionPoolDataSource (oracle) 
    139     urlprefix       JDBC URL required to establish connection to the database. Example: jdbc:oracle:thin:@//host:1521/schema (oracle)  
    140     xcolumn         "Logitude" field of a spatial database 
    141     ycolumn         "Latitude" field of a spatial database 
    142     geom_name       This parameter records the spatial location associated with the dataset used.  The value of this parameter is calculated  
    143                     automatically using the values of xcolumn and ycolumn.  This parameter must be specified for dbtype "locationxy" 
    144     sqlView.1.typeName  An identifier for the SQL used to retrieve the dataset required from the database 
    145     sqlView.1.sqlQuery  The SQL statement used to retrieve the dataset required from the database. Geoserver supports the following SQL keywords:  
     140                    (postGreSQL), oracle.jdbc.pool.OracleConnectionPoolDataSource (oracle)[[BR]] 
     141    urlprefix       JDBC URL required to establish connection to the database. Example: jdbc:oracle:thin:@//host:1521/schema (oracle)[[BR]]  
     142    xcolumn         "Logitude" field of a spatial database [[BR]] 
     143    ycolumn         "Latitude" field of a spatial database [[BR]] 
     144    geom_name       This parameter records the spatial location associated with the dataset used.  The value of this parameter is calculated [[BR]] 
     145                    automatically using the values of xcolumn and ycolumn.  This parameter must be specified for dbtype "locationxy" [[BR]] 
     146    sqlView.1.typeName  An identifier for the SQL used to retrieve the dataset required from the database [[BR]] 
     147    sqlView.1.sqlQuery  The SQL statement used to retrieve the dataset required from the database. Geoserver supports the following SQL keywords: [[BR]] 
    146148                        SELECT, FROM, WHERE, UNION, UNION ALL, ORDER BY, GROUP BY, JOIN.  It is recommended that tables in a SELECT statement be  
    147                         uniquely identified using "schema." prefix. 
     149                        uniquely identified using "schema." prefix. [[BR]] 
    148150 
    149151'''Table 1: A List of Parameters required to configure a DataStore''' 
     
    283285 
    284286 
     287[img http://proj.badc.rl.ac.uk/ndg/attachment/wiki/GeoManual/table.JPG] 
     288[[BR]] 
    285289'''Table 2: Different Mapping Types''' 
     290 
     291 
    286292Geoserver supports any combination of the three aforementioned mappings under an AttributeMapping element.  In addition, as Table 2 above highlights, it is also possible to assign a string literal value, i.e. a value that is not retrieved from any of fields in the SQL result set, to a target attribute.   In order for Geoserver to accurately distinguish between SQL field values and string literal value, the former should be in single quotes (‘’). It is also possible to concatenate values of a number of SQL fields or string literal value or a combination of both using the strContact function. The format of this function is as follows: 
    287 strConcat (param1, param2)    
     293 
     294{{{ 
     295strConcat (param1, param2) 
     296}}} 
     297    
    288298Geoserver allows the use of nested strConcat functions, i.e. use of a strConcat function as a parameter of another strConcat function.  A string literal value should be in single quotes if used as one of the parameters of a strConcat functions.   The following is an example of the use of the strConcat function in an attribute mapping: 
    289299 
     300 
     301{{{ 
    290302<AttributeMapping> 
    291 <targetAttribute>csml:location</targetAttribute> 
    292 <sourceExpression> 
    293                 <OCQL> 
    294 strConcat((strConcat(HIGH_PRCN_LON,' ')),HIGH_PRCN_LAT) 
    295 </OCQL> 
    296         </sourceExpression> 
     303     <targetAttribute>csml:location</targetAttribute> 
     304     <sourceExpression> 
     305         <OCQL>strConcat((strConcat(HIGH_PRCN_LON,' ')),HIGH_PRCN_LAT)</OCQL> 
     306     </sourceExpression> 
    297307</AttributeMapping> 
    298  
    299 The output XML is: <csml:location>-2.76 67</csml:location> 
     308}}} 
     309 
     310 
     311The output XML is:  
     312{{{ 
     313<csml:location>-2.76 67</csml:location> 
     314}}} 
     315 
    300316 
    301317It should also be noted that in order to specify mapping to a child element of an element in the target schema, the full XPath for the child element must be specified under the targetAttribute element.  The following example demonstrates the use of XPath in targetAttribute element: 
    302318 
    303319 
     320 
     321{{{ 
    304322<AttributeMapping> 
    305 <targetAttribute> 
    306 csml:value/csml:PointSeriesCoverage/csml:pointSeriesDomain/csml:TimeSeries/csml:timePositionList 
    307 </targetAttribute> 
    308         <sourceExpression> 
    309                 <OCQL>OB_END_TIME</OCQL> 
    310         </sourceExpression> 
     323   <targetAttribute> 
     324      csml:value/csml:PointSeriesCoverage/csml:pointSeriesDomain/csml:TimeSeries/csml:timePositionList 
     325   </targetAttribute> 
     326   <sourceExpression> 
     327      <OCQL>OB_END_TIME</OCQL> 
     328   </sourceExpression> 
    311329</AttributeMapping> 
     330}}} 
     331 
    312332 
    313333The only exception to the aforementioned rule applies to mapping to a gml:PointPropertyType element. In such a case, targetAttribute element should contain an XPath up to the element that is of type gml:PointPropertyType.  For example, if the definition of an element, say “location” is as follows: 
    314334 
    315 <element name=”location” type=”gml:PointPropertyType”/> 
     335 
     336{{{ 
     337<element name="location" type="gml:PointPropertyType"/> 
     338}}} 
     339 
    316340 
    317341then the value of the targetAttribute element that corresponds to this element should just be location instead of location/gml:Point/gml:pos.  Furthermore, the OCQL value of this element should be the value of geom_name parameter as mentioned in Table 1.  The reason for this exception is that Geoserver is capable of automatically defining the value of a gml:PointPropertyType element based on the spatial location associated (i.e. the value of geom_name parameter) with the dataset used. 
    318342 
    319 5.4.1 Mapping to Multiple Occurrence Elements 
     343''5.4.1 Mapping to Multiple Occurrence Elements'' 
    320344 
    321345In order to accurately map to an element in the target schema which has multiplicity greater than 1, Geoserver requires the use of the “isMultiple” element under the AttributeMapping element.  So in order to output the following: 
    322346 
    323 <root> 
    324         <element> 
     347       
     348{{{ 
     349  <root> 
     350             <element> 
    325351                <child>value1</child> 
    326         <element> 
    327 <element> 
    328         <child>value2</child> 
    329 </element> 
    330 </root> 
     352             <element> 
     353             <element> 
     354                <child>value2</child> 
     355             </element> 
     356        </root> 
     357}}} 
     358 
    331359 
    332360the mapping configuration should be as follows: 
    333361 
     362     
     363{{{ 
    334364<AttributeMapping> 
    335 <targetAttribute>root/element</targetAttribute> 
    336         <targetAttributeNode>elementType</targetAttributeNode> 
    337         <!—in the target Schema this should be <element name=”element” type=”elementType”/>--> 
    338         <isMultiple>true</isMultiple> 
    339 </AttributeMapping> 
    340  
    341 <AttributeMapping> 
    342 <targetAttribute>root/element/child </targetAttribute> 
    343         <sourceExpression> 
    344 <OCQL>value</OCQL> 
    345         </sourceExpression> 
    346 </AttributeMapping> 
     365       <targetAttribute>root/element</targetAttribute> 
     366       <targetAttributeNode>elementType</targetAttributeNode> 
     367       <!—in the target Schema this should be <element name=”element” type=”elementType”/>--> 
     368       <isMultiple>true</isMultiple> 
     369    </AttributeMapping> 
     370 
     371    <AttributeMapping> 
     372       <targetAttribute>root/element/child </targetAttribute> 
     373       <sourceExpression> 
     374         <OCQL>value</OCQL> 
     375       </sourceExpression>  
     376    </AttributeMapping> 
     377}}} 
     378 
    347379 
    348380The current version of Geoserver cannot handle a mappable multiple occurrence element in the target schema. For example, at present it is not possible to output the following through Geoserver: 
    349381 
     382 
     383{{{ 
    350384<root> 
    351385        <element> 
     
    354388        <element> 
    355389</root> 
    356  
    357 5.4.2 Mapping to List Elements 
     390}}} 
     391 
     392 
     393''5.4.2 Mapping to List Elements'' 
    358394 
    359395Mapping to a list type element in the target schema requires the use of the “isList” element under the AttributeMapping element. So, in order to output the following: 
    360396 
     397 
     398{{{ 
    361399<root> 
    362400        <element> 
     
    364402        <element> 
    365403</root> 
     404}}} 
    366405 
    367406The mapping configuration should be as follows: 
    368407 
     408 
     409{{{ 
    369410<AttributeMapping> 
    370411<targetAttribute>root/element </targetAttribute> 
     
    379420        </sourceExpression> 
    380421</AttributeMapping> 
     422}}} 
    381423 
    382424Below is a complete example of the typeMapping element, which uses all aspects of mapping configuration as mentioned above: 
    383425 
     426 
     427{{{ 
    384428<typeMappings> 
    385429<FeatureTypeMapping> 
     
    490534                </FeatureTypeMapping> 
    491535        </typeMappings> 
     536}}}