locality

Table info.

Title Locality
Description Locality

Fields

Name Type Required Index Hidden On form Title Pick list Description
LocalityID int(11) PRI
TimestampCreated datetime Created The timestamp the locality record was created.
TimestampModified datetime MUL Last edited The timestamp the locality record was last modified.
Version int(11) Version version
Datum varchar(50) Datum Datum
  • GDA94
  • NAD83
  • WGS84
  • AGD66
  • AGD84
  • Minna
The geodetic datum of the geocode
ElevationAccuracy double Alt. accuracy Plus or minus -- in meters.
ElevationMethod varchar(50) Alt. method AltitudeMethod
  • Altimeter
  • Altimeter (corrected)
  • DEM
  • Field estimate
  • Google Earth
  • GPS
  • Map
  • Unknown
GML text GML gml
GUID varchar(128) GUID guid
Lat1Text varchar(50) verbatimLatitude
Lat2Text varchar(50) Lat2text User entry for Latitude2
LatLongAccuracy double Uncertainty (m)
LatLongMethod varchar(50) Protocol GeocodeSource
  • AMG conversion
  • GPS
  • Google Earth
  • GEOLocate
  • GeoNames
  • GA gazetteer
  • Map or atlas
The source of the geocode
LatLongType varchar(50) Latitude/Longitude Type The type of area described by the Latitude Longitude data (Point, Line, Rectangle)
Latitude1 decimal(12,10) Latitude Latitude
Latitude2 decimal(12,10) Latitude Latitude
LocalityName varchar(255) MUL Locality The locality description provided by the collector. Any information interpreted or corrected by data entry personnel should be enclosed in brackets.
Long1Text varchar(50) verbatimLongitude
Long2Text varchar(50) Long2text User entry for Longitude2
Longitude1 decimal(13,10) Longitude Longitude
Longitude2 decimal(13,10) Longitude2 Longitude of second point
MaxElevation double Max. altitude If altitude is given as a range, enter the higher value here.
MinElevation double Min. altitude The altitude measurement (whether in metres or feet). If altitude is given as a range, enter the lower value here.
NamedPlace varchar(255) MUL namedPlace
OriginalElevationUnit varchar(50) Uncertainty (class) GeocodePrecision
  • 1. 0 - 50 m
  • 2. 50 m - 1 km
  • 3. 1 - 10 km
  • 4. 10 - 25 km
  • 5. > 25 km
The precision of the geocode
OriginalLatLongUnit int(11) Original Latitude Longitude Unit i.e. Decimal, Deg/Min/Sec, ...
RelationToNamedPlace varchar(120) MUL relationToNamedPlace
Remarks text Locality uniquifier
ShortName varchar(32) Coll. uncertainty The precision of the geocode, including units, if provided by the collector
SrcLatLongUnit tinyint(4) Src Lat Long Unit srcLatLongUnit
Text1 text Alt. unit AltitudeUnit
  • metres
  • feet
The units that the altitude measurement is given in
Text2 text Source GeoreferencedByPickList
  • Collector
  • Data entry person
  • Exchange data
  • AVH annotation
The source of the geocode
VerbatimElevation varchar(50) Verbatim altitude The precision of the altitude, if provided by the collector or on the exchange label
Visibility tinyint(4) Visibility visibility
GeographyID int(11) MUL
VisibilitySetByID int(11) MUL
DisciplineID int(11) MUL
CreatedByAgentID int(11) MUL
ModifiedByAgentID int(11) MUL
SGRStatus tinyint(4) Sgr Status sgrStatus
Text3 text Text3 text3
Text4 text Text4 text4
Text5 text Text5 text5
VerbatimLatitude varchar(50) Verbatim Latitude verbatimLatitude
VerbatimLongitude varchar(50) Verbatim Longitude verbatimLongitude
PaleoContextID int(11) MUL
YesNo1 bit(1) Yes No1 yesNo1
YesNo2 bit(1) Yes No2 yesNo2
YesNo3 bit(1) Yes No3 yesNo3
YesNo4 bit(1) Yes No4 yesNo4
YesNo5 bit(1) Yes No5 yesNo5

Indexes

Name Fields Unique Nullable
FK714BFD634CE675DE DisciplineID
FK714BFD635327F942 ModifiedByAgentID
FK714BFD637699B003 CreatedByAgentID
FK714BFD637BF1F70B VisibilitySetByID
FK714BFD6397ECD2B2 PaleoContextID
FK714BFD63D649F6D0 GeographyID
LocalityDisciplineIDX DisciplineID
localityNameIDX LocalityName
localityTimestampModifiedIDX TimestampModified
NamedPlaceIDX NamedPlace
PRIMARY LocalityID
RelationToNamedPlaceIDX RelationToNamedPlace

One-to-many relationships

Name Field Related table Related field
FKFEB30F22A666A5C4 LocalityID collectingevent LocalityID
FKB688EB95A666A5C4 LocalityID geocoorddetail LocalityID
FKE4EEDE6EA666A5C4 LocalityID latlonpolygon LocalityID
FKB39C36C6A666A5C4 LocalityID localityattachment LocalityID
FK9877F54AA666A5C4 LocalityID localitycitation LocalityID
FKBB0D3F74A666A5C4 LocalityID localitydetail LocalityID
FK29EB5CA2A666A5C4 LocalityID localitynamealias LocalityID

Many-to-one relationships

Name Field Related table Related field
FK714BFD634CE675DE DisciplineID discipline UserGroupScopeId
FK714BFD635327F942 ModifiedByAgentID agent AgentID
FK714BFD637699B003 CreatedByAgentID agent AgentID
FK714BFD637BF1F70B VisibilitySetByID specifyuser SpecifyUserID
FK714BFD6397ECD2B2 PaleoContextID paleocontext PaleoContextID
FK714BFD63D649F6D0 GeographyID geography GeographyID

locality_before_insert

EventINSERT
TimingBEFORE
Statement:
DROP TRIGGER IF EXISTS locality_before_insert;
 
DELIMITER $$
 
CREATE TRIGGER locality_before_insert BEFORE INSERT ON locality
FOR EACH ROW
  BEGIN
 
    DECLARE var_enteredbycollector INTEGER;
 
    IF isnull(@DISABLE_TRIGGER) THEN
      IF (NEW.Text2 IS NULL OR NEW.Text2='') AND NEW.Latitude1 IS NOT NULL AND NEW.Longitude1 IS NOT NULL THEN
        IF NEW.LatLongMethod IN ('GEOLocate', 'GA gazetteer', 'Google Earth', 'GeoNames') THEN
          SET NEW.Text2='Data entry person';
        ELSE
          IF NEW.LatLongMethod IN ('GPS') THEN
            SET NEW.Text2='Collector';
          END IF;
        END IF;
 
        SELECT COUNT(*)
        INTO var_enteredbycollector
        FROM collectingevent ce
        JOIN collector c ON ce.CollectingEventID=c.CollectingEventID
        WHERE c.AgentID=NEW.CreatedByAgentID;
 
        IF var_enteredbycollector>0 THEN
            SET NEW.Text2='Collector';
        END IF;
      END IF;
 
      IF NEW.LatLongMethod IN ('GEOLocate', 'Google Earth', 'GeoNames') THEN
        SET NEW.Datum = 'WGS84';
      ELSE
        IF NEW.LatLongMethod = 'GA gazetteer' THEN
          SET NEW.Datum = 'GDA94';
        END IF;
      END IF;
    END IF;
  END
 
DELIMITER ;

locality_before_update

EventUPDATE
TimingBEFORE
Statement:
DROP TRIGGER IF EXISTS locality_before_update;
 
DELIMITER $$
 
CREATE TRIGGER locality_before_update BEFORE UPDATE ON locality
FOR EACH ROW
  BEGIN
    DECLARE var_who VARCHAR(64);
    DECLARE var_georeferencedby INTEGER;
    DECLARE var_georeferenceddate DATETIME;
    DECLARE var_geocoorddetailid INTEGER;
 
    DECLARE var_island VARCHAR(64);
    DECLARE var_island_group VARCHAR(64);
    DECLARE var_water_body VARCHAR(64);
    DECLARE var_island_id INTEGER;
 
 
    IF isnull(@DISABLE_TRIGGER) THEN
      SET var_who = NEW.Text2;
      IF (NEW.Text2 IS NULL OR NEW.Text2='') AND NEW.Latitude1 IS NOT NULL AND NEW.Longitude1 IS NOT NULL AND (OLD.Latitude1 IS NULL OR OLD.Longitude1 IS NULL) THEN
        IF NEW.LatLongMethod IN ('GEOLocate', 'GA gazetteer', 'Google Earth', 'GeoNames') THEN
          SET NEW.Text2='Data entry person';
          SET var_who='Data entry person';
        ELSE
          IF NEW.LatLongMethod IN ('GPS') THEN
            SET NEW.Text2='Collector';
            SET var_who='Collector';
          END IF;
        END IF;
      END IF;
 
      IF NEW.LatLongMethod IN ('GEOLocate', 'Google Earth', 'GeoNames') THEN
        SET NEW.Datum = 'WGS84';
      ELSE
        IF NEW.LatLongMethod = 'GA gazetteer' THEN
          SET NEW.Datum = 'GDA94';
        END IF;
      END IF;
 
      IF (NEW.Latitude1 IS NOT NULL AND NEW.Longitude1 IS NOT NULL) AND (NEW.Latitude1!=OLD.Latitude1 OR NEW.Longitude1!=OLD.Longitude1) AND var_who IN ('Collector', 'Data entry person') THEN
 
        IF var_who='Data entry person' THEN
          SET var_georeferencedby=24365;
          SET var_georeferenceddate=NEW.TimestampModified;
        ELSE
          SELECT StartDate
          INTO var_georeferenceddate
          FROM collectingevent
          WHERE LocalityID=NEW.LocalityID
          LIMIT 1;
 
        END IF;
 
        IF var_georeferencedby IS NOT NULL OR var_georeferenceddate IS NOT NULL THEN
            SELECT GeoCoordDetailID
            INTO var_geocoorddetailid
            FROM geocoorddetail
            WHERE LocalityID=NEW.LocalityID;
 
            IF var_geocoorddetailid IS NOT NULL THEN
                UPDATE geocoorddetail
                SET TimestampModified=NOW(), ModifiedByAgentID=NEW.ModifiedByAgentID,
                  Version=Version+1, AgentID=var_georeferencedby, GeoRefDetDate=var_georeferenceddate
                WHERE GeoCoordDetailID=var_geocoorddetailid;
            ELSE
                SELECT MAX(GeoCoordDetailID)+1
                INTO var_geocoorddetailid
                FROM geocoorddetail;
 
                INSERT INTO geocoorddetail (GeoCoordDetailID, TimestampCreated, TimestampModified, Version, GeoRefDetDate, CreatedByAgentID, LocalityID, AgentID)
                VALUES (var_geocoorddetailid, NOW(), NOW(), 0, var_georeferenceddate, NEW.ModifiedByAgentID, NEW.LocalityID, var_georeferencedby);
 
            END IF;
        END IF;
      END IF;
 
    END IF;
  END
 
DELIMITER ;

View: LocalitySubForm (Common)

<view name="LocalitySubForm"
      class="edu.ku.brc.specify.datamodel.Locality"
      busrules="edu.ku.brc.specify.datamodel.busrules.LocalityBusRules">
    <desc><![CDATA[Locality SubForm form.]]></desc>
    <altviews>
        <altview name="Locality SubForm View" viewdef="LocalitySubForm" mode="view"/>
        <altview name="Locality SubForm Edit" viewdef="LocalitySubForm" mode="edit" default="true"/>
    </altviews>
</view>

View def.: LocalitySubForm

<viewdef type="form"
      name="LocalitySubForm"
      class="edu.ku.brc.specify.datamodel.Locality"
      gettable="edu.ku.brc.af.ui.forms.DataGetterForObj"
      settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
 
    <desc><![CDATA[Locality SubForm]]></desc>
    <columnDef>p,2px,p,10px,p,2px,p,p:g</columnDef>
    <rowDef auto="true" cell="p" sep="2dlu"/>
 
    <rows>
        <row>
            <cell type="label" labelfor="6"/>
            <cell type="field" id="6" name="localityName" uitype="text" colspan="6"/>
        </row>
        <row>
            <cell type="label" labelfor="4"/>
            <cell type="field" id="4" name="this" uitype="plugin" initialize="name=LatLonUI" colspan="4"/>
        </row>
        <row>
            <cell type="label" labelfor="1"/>
            <cell type="field" id="1" name="datum" uitype="text"/>
            <cell type="label" labelfor="2"/>
            <cell type="field" id="2" name="elevationMethod" uitype="text"/>
        </row>
        <row>
            <cell type="label" labelfor="5"/>
            <cell type="field" id="5" name="geography" uitype="querycbx" initialize="name=Geography"/>
        </row>
    </rows>
</viewdef>