org.gbif.datatester.tests
Class GeographicErrorTest

java.lang.Object
  extended by org.gbif.datatester.AbstractDataTest
      extended by org.gbif.datatester.AbstractRecordTest
          extended by org.gbif.datatester.tests.GeographicErrorTest
All Implemented Interfaces:
DataTest

public class GeographicErrorTest
extends AbstractRecordTest

Generic geographic error test implementation. Given a point (latitude and longitude in decimal degrees with WGS84 datum), an uncertainty value for the point (in meters), and the administrative regions originally related with the record, this test uses the coordinates to check that the administrative regions are consistent with the ones provided by a simple feature vector map.

It accepts six parameters: longitudeConcept, latitudeConcept, uncertaintyConcept, administrativeRegionsConcepts, administrativeRegionsFeatures and featureDataReader.

The first three must contain the identifier of a known Concept with a "double" DataType, the next one must contain one or more concept identifiers (comma separated) of known Concepts with a "string" DataType, the other one must contain one or more feature identifiers (comma separated) corresponding to each administrative region to be tested and featureDataReader must contain the class name (including java package) of an external class implementing the ExternalGeospatialVectorReader interface. The number and order of elements in administrativeRegionsConcepts and administrativeRegionsFeatures must match. uncertaintyConcept is optional.

A typical configuration entry for this test would look like:

  <test id="11" class="org.gbif.datatester.tests.GeographicErrorTest">
    <parameter name="longitudeConcept">
      <value v="Longitude" />
    </parameter>
    <parameter name="latitudeConcept">
      <value v="Latitude" />
    </parameter>
    <parameter name="uncertaintyConcept">
      <value v="Uncertainty" />
    </parameter>
    <parameter name="administrativeRegionsConcepts">
      <value v="Country,state,province" />
    </parameter>
    <parameter name="administrativeRegionsFeatures">
      <value v="Country_name,State_name,County_name" />
    </parameter>
    <parameter name="featureDataReader">
      <value v="myClassThatCanReadVectorFiles" />
    </parameter>
  </test>
 

Version:
$Revision: 1.7 $
Author:
Alexandre Marino ( marino at cria . org . br ) Renato De Giovanni ( renato at cria . org . br )

Field Summary
static java.lang.String DISTANCE_TAG_ID
          Shortcut to the "distance between x,y point and polygon" tag.
static java.lang.String GEOGRAPHIC_ERROR_TAG_ID
          Shortcut to the "geographic error" tag.
static java.lang.String MAPPED_FEATURE_TAG_ID
          Shortcut to the "mapped feature" value tag.
static java.lang.String MARINE_TAG_ID
          Shortcut to the "marine" tag.
 
Fields inherited from class org.gbif.datatester.AbstractDataTest
instanceId, knownConcepts, locale, result
 
Constructor Summary
GeographicErrorTest()
          Contructs a generic geographic error test.
 
Method Summary
protected  void doInitialize()
          Internal method to initialize the test.
protected  boolean doTest(GenericRecord genericRecord)
          Detect inconsistencies in country, stateprovince and/or county versus related coordinates.
 java.lang.String getVersion()
          Outputs the current version of this test based on the CVS revision.
 
Methods inherited from class org.gbif.datatester.AbstractRecordTest
doTest, minNumberOfRecords, test
 
Methods inherited from class org.gbif.datatester.AbstractDataTest
declareMandatoryConcept, declareOptionalConcept, declareParameter, declareTag, getDescription, getInstanceId, getInstanceXml, getMandatoryConcepts, getOptionalConcepts, getParametersMetadata, getParameterValue, getPossibleTags, getResourceBundle, getResult, getString, initialize, initialize, loadResourceBundle, setLocale, setResourceBundleBaseName, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GEOGRAPHIC_ERROR_TAG_ID

public static final java.lang.String GEOGRAPHIC_ERROR_TAG_ID

Shortcut to the "geographic error" tag.

See Also:
Constant Field Values

MAPPED_FEATURE_TAG_ID

public static final java.lang.String MAPPED_FEATURE_TAG_ID

Shortcut to the "mapped feature" value tag.

See Also:
Constant Field Values

MARINE_TAG_ID

public static final java.lang.String MARINE_TAG_ID

Shortcut to the "marine" tag.

See Also:
Constant Field Values

DISTANCE_TAG_ID

public static final java.lang.String DISTANCE_TAG_ID

Shortcut to the "distance between x,y point and polygon" tag.

See Also:
Constant Field Values
Constructor Detail

GeographicErrorTest

public GeographicErrorTest()

Contructs a generic geographic error test.

Method Detail

doInitialize

protected void doInitialize()
                     throws DataTesterException

Internal method to initialize the test.

Overrides:
doInitialize in class AbstractDataTest
Throws:
DataTesterException

doTest

protected boolean doTest(GenericRecord genericRecord)
                  throws DataTesterException

Detect inconsistencies in country, stateprovince and/or county versus related coordinates.

Specified by:
doTest in class AbstractDataTest
Parameters:
genericRecord - Record to be tested.
Returns:
False if at least one tag has been attached.
Throws:
DataTesterException

getVersion

public java.lang.String getVersion()

Outputs the current version of this test based on the CVS revision.

Specified by:
getVersion in interface DataTest
Specified by:
getVersion in class AbstractDataTest
Returns:
Test version.