Class AbstractLocation
java.lang.Object
org.apache.sis.referencing.gazetteer.AbstractLocation
- Direct Known Subclasses:
SimpleLocation
Identifiable geographic place. A geographic place may be identified by a name (for example “Eiffel Tower”),
by a postcode, or any other method specified by the location type identifications.
ISO 19112 describes the following properties as mandatory, but Apache SIS relaxes this restriction by
providing default values (possibly null) in most cases:
- geographic identifier (the value, for example a name or code)
- geographic extent (the position of the identified thing)
- administrator (who is responsible for this identifier)
- location type (which specifies the nature of the identifier and its associated geographic location)
- temporal extent
- alternative geographic identifier
- envelope (an Apache SIS extension not in ISO 19112 standard)
- position (mandatory if the geographic identifier contains insufficient information to identify location)
- parent location instance
- child location instance
- Since:
- 0.8
- Version:
- 0.8
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CharSequenceThe geographic identifier, ornullif unspecified.private AbstractLocationTypeThe description of the nature of this geographic identifier, ornullif unspecified. -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)AbstractLocation(AbstractLocationType type, CharSequence identifier) Temporary workaround for the lack ofLocationTypeinterface andAbstractLocationTypebeing package-private.protectedAbstractLocation(ModifiableLocationType type, CharSequence identifier) Creates a new location for the given geographic identifier. -
Method Summary
Modifier and TypeMethodDescriptionReturns the organization responsible for defining the characteristics of the location instance.Collection<? extends org.opengis.util.InternationalString>Returns other identifier(s) for the location instance.Collection<? extends AbstractLocation>Returns location instances of a different location type which subdivides this location instance.org.opengis.geometry.EnvelopeReturns an envelope that encompass the location.org.opengis.metadata.extent.GeographicExtentReturns a description of the location instance.org.opengis.util.InternationalStringReturns a unique identifier for the location instance.final ModifiableLocationTypeReturns a description of the nature of this geographic identifier.Collection<? extends AbstractLocation>Returns location instances of a different location type, for which this location instance is a sub-division.org.opengis.geometry.coordinate.PositionReturns coordinates of a representative point for the location instance.org.opengis.metadata.extent.TemporalExtentReturns the date of creation of this version of the location instance.(package private) final voidSets the location type to the unique child of current type.toString()Returns a string representation of this location.(package private) final AbstractLocationTypetype()Workaround for the lack ofLocationTypeinterface in GeoAPI 3.0.
-
Field Details
-
type
The description of the nature of this geographic identifier, ornullif unspecified.This field is non-final for sub-class constructors convenience, but its value should not be changed after
Locationconstruction.- See Also:
-
identifier
The geographic identifier, ornullif unspecified.- See Also:
-
-
Constructor Details
-
AbstractLocation
Creates a new location for the given geographic identifier. This constructor acceptsnullarguments, but this is not recommended.Upcoming API change — generalization
in a future SIS version, the type oftypeargument may be generalized to theorg.opengis.referencing.gazetteer.Locationinterface. This change is pending GeoAPI revision.- Parameters:
type- the description of the nature of this geographic identifier.identifier- the geographic identifier to be returned bygetGeographicIdentifier().
-
AbstractLocation
AbstractLocation(AbstractLocationType type, CharSequence identifier) Temporary workaround for the lack ofLocationTypeinterface andAbstractLocationTypebeing package-private. We do not want to exposeAbstractLocationTypein public API for now.
-
-
Method Details
-
setTypeToChild
final void setTypeToChild()Sets the location type to the unique child of current type. This method should be invoked only when the caller know that there is at least one children and that the children class isFinalLocationType(for performance reason). -
getGeographicIdentifier
public org.opengis.util.InternationalString getGeographicIdentifier()Returns a unique identifier for the location instance. The methods of identifying locations is specified by the location type identifications.Examples: ifIn order to ensure that a geographic identifier is unique within a wider geographic domain, the geographic identifier may need to include an identifier of an instance of a parent location type, for example “Paris, Texas”.LocationType.getIdentifications()contain “name”, then geographic identifiers may be country names like “Japan” or “France”, or places like “Eiffel Tower”. If location type identifications contain “code”, then geographic identifiers may be “SW1P 3AD” postcode.- Returns:
- unique identifier for the location instance.
- See Also:
-
getAlternativeGeographicIdentifiers
public Collection<? extends org.opengis.util.InternationalString> getAlternativeGeographicIdentifiers()Returns other identifier(s) for the location instance. The default implementation returns an empty set.- Returns:
- other identifier(s) for the location instance, or an empty collection if none.
-
getTemporalExtent
public org.opengis.metadata.extent.TemporalExtent getTemporalExtent()Returns the date of creation of this version of the location instance. The default implementation returnsnull.- Returns:
- date of creation of this version of the location instance, or
nullif none.
-
getGeographicExtent
public org.opengis.metadata.extent.GeographicExtent getGeographicExtent()Returns a description of the location instance. This properties is mandatory according ISO 19112, but Apache SIS nevertheless allowsnullvalue. If non-null, SIS implementations typically provide instances of geographic bounding boxes.- Returns:
- description of the location instance, or
nullif none. - See Also:
-
getEnvelope
public org.opengis.geometry.Envelope getEnvelope()Returns an envelope that encompass the location. This property is partially redundant withgetGeographicExtent(), except that this method allows envelopes in non-geographic CRS.The default implementation copies the
getGeographicExtent()in a new envelope associated to the default geographic CRS.- Returns:
- envelope that encompass the location, or
nullif none.
-
getPosition
public org.opengis.geometry.coordinate.Position getPosition()Returns coordinates of a representative point for the location instance. This is typically (but not necessarily) the centroid of the location instance.The default implementation returns the getEnvelope() median position.
- Returns:
- coordinates of a representative point for the location instance, or
nullif none.
-
getLocationType
Returns a description of the nature of this geographic identifier.Upcoming API change — generalization
in a future SIS version, the type of returned element may be generalized to theorg.opengis.referencing.gazetteer.Locationinterface. This change is pending GeoAPI revision. If applied, this method will be made non-final.- Returns:
- the nature of the identifier and its associated geographic location.
-
type
Workaround for the lack ofLocationTypeinterface in GeoAPI 3.0. This workaround will be removed in a future SIS version if the location type interface is introduced in a future GeoAPI version. -
getAdministrator
Returns the organization responsible for defining the characteristics of the location instance. The default implementation returns the owner.Upcoming API change — generalization
in a future SIS version, the type of returned element may be generalized to theorg.opengis.metadata.citation.Partyinterface. This change is pending GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.- Returns:
- organization responsible for defining the characteristics of the location instance, or
null. - See Also:
-
getParents
Returns location instances of a different location type, for which this location instance is a sub-division. The default implementation returns an empty list.Upcoming API change — generalization
in a future SIS version, the type of collection elements may be generalized to theorg.opengis.referencing.gazetteer.Locationinterface. This change is pending GeoAPI revision.- Returns:
- parent locations, or an empty collection if none.
- See Also:
-
getChildren
Returns location instances of a different location type which subdivides this location instance. The default implementation returns an empty list.Upcoming API change — generalization
in a future SIS version, the type of collection elements may be generalized to theorg.opengis.referencing.gazetteer.Locationinterface. This change is pending GeoAPI revision.- Returns:
- child locations, or an empty collection if none.
- See Also:
-
toString
Returns a string representation of this location. This representation is mostly for debugging purpose and may change in any future Apache SIS version.
-