BETA VERSION
@since 3.0

Spatial Extensions are composed of several concepts:

  • a spatially enabled database, such as Oracle Spatial, MySQL, Postgis or Microsoft SQL Server 2008.
  • a specific property type to store / read geometries, such as POINT, LINE, ...
  • hibernate extensions to query data based on spatial attributes
  • built in services to integrate with 3rd party providers such as Google Maps or ViaMichelin for maps or geocoding
  • widgetry to show maps and position objects on maps

Spatial Database

A spatial enabled database has the following capabilities:

- Store a Geometry (POINT, ...) as a column in a table using a mapping coordinate system.
- Query on that column using spatial functions
- Optionally, index those spatial data for fast retrieval.

Spatially enabled database are:

  • Oracle 11g Standard and Enterprise Edition
  • MySQL 5.1 and above (indexing not supported as of 5.5)
  • Postgres with the GIS Extension (PostGis)
  • Microsoft SQL Server 2008

Other databases or version do not have spatial support.

Enabling the spatial components in Requea

By default, the spatial components are not enabled. You must specify that you want spatial functionalities in the requeadb.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
   <DbType>oracle11g</DbType>
**~    <DbSpatial>true</DbSpatial>**
   <DbDriver>oracle.jdbc.OracleDriver</DbDriver>
   <DbURL>jdbc:oracle:thin:@rhel6ws.requea.com:1522:ORCL</DbURL>
   <DbUser>requea</DbUser>
   <DbPassword>xxxx</DbPassword>
</config>

Storing spatial information

Spatial information (Geometries) are stored as special columns in the Dataabase.
In Requea, you should use the type "Geometry" in the Entity Property definition:

ScreenShot2011-10-13at3.50.13PM.png

Querying on spatial using HQL

 The following functions can be used in HQL query (in combination with non spatial criteria):

  • dimension
  • geometrytype
  • srid
  • envelope
  • astext
  • asbinary
  • isempty
  • issimple
  • boundary
  • overlaps
  • intersects
  • contains
  • crosses
  • disjoint
  • equals
  • touches
  • within
  • relate
  • distance
  • buffer
  • convexhull
  • difference
  • intersection
  • symdifference
  • geomunion
  • extent (oracle)
  • transform (oracle)

Oracle specific functions:

  • centroid
  • concat_lines
  • aggr_convexhull
  • aggr_union
  • lrs_concat

Geo Services

There are 3 built in services that are available for spatial operations, in addition to storing and querying information:

  • Geocoding provides a WSG84 coordinate (Latitude, Longitude) based on the postal address.
  • Mapping provides Maps to show the position of a point, line, ... on the map.
  • Linking provides a URL to invoke the web site of a mapping provider to show one point on a map

GeoSpatial Providers

- GoogleMaps:

  • GeoCoding: Yes, subject to licence agreements. Should not be used on an Intranet or Extranet
  • Mapping: Yes, subject to licence agreements. Should not be used on an Intranet or Extranet
  • Linking: Yes

- GoogleMaps Premier:

  • GeoCoding: Yes
  • Mapping: Yes
  • Linking: Yes

- ViaMichelin:

  • GeoCoding: Yes
  • Mapping: Yes
  • Linking: Yes

- CloudMade:

  • GeoCoding: No / Poor
  • Mapping: Yes
  • Linking: Yes

NOTE that Services are subject to Usage condition. Please refer to their website.

Setup of GeoServices

ViaMichelin and GoogleMaps services have their own bundles. Those bundles are packages as product.
You must add the product in your configuration.

Please note that the version of the platform should the same as the version of the GeoSpatial Extensions.

Product configuration / GeoSpatial.

  • Geocoding:

The ViaMichelin GeoCoder is a SOAP API call and requires viamichelin credentials:

img42.png

  • GeoMapping 

The ViaMichelin GeoMapping service requires the JavaScript Key (see image above).

Note that the API key MUST be setup with your website URL (localhost for a test system, ...).

Using Geocoding

The Geocoding is a classical JavaScript service:

var res = Geocoder.geocodeAddress(street,null,data.rqCommune.rqNomInsee,null,"FRA");
if(res != null) {
    data.rqGeoLoc = res.Location;
}

The returned object is a Location object that contains the following properties:

  • City
  • StreetNumber
  • StreetLabel
  • ZipCode
  • State
  • Country
  • Location as a POINT (lat, long)

Using Geomapping

You must setup the Mapper you want to use in the com.requea.dynapage.geospatial.geomap system parameter:

GeoMapping setup

When the mapping service is defined, Geolocated POINTS will be rendered as a map:

Geo Map

Tags:
Created by Pierre Dubois on 2011/10/07 11:11
     
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 9.11.5 - Documentation