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 CharSequence
The geographic identifier, ornull
if unspecified.private AbstractLocationType
The description of the nature of this geographic identifier, ornull
if unspecified. -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
AbstractLocation
(AbstractLocationType type, CharSequence identifier) Temporary workaround for the lack ofLocationType
interface andAbstractLocationType
being package-private.protected
AbstractLocation
(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.Envelope
Returns an envelope that encompass the location.org.opengis.metadata.extent.GeographicExtent
Returns a description of the location instance.org.opengis.util.InternationalString
Returns a unique identifier for the location instance.final ModifiableLocationType
Returns 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.Position
Returns coordinates of a representative point for the location instance.org.opengis.metadata.extent.TemporalExtent
Returns the date of creation of this version of the location instance.(package private) final void
Sets the location type to the unique child of current type.toString()
Returns a string representation of this location.(package private) final AbstractLocationType
type()
Workaround for the lack ofLocationType
interface in GeoAPI 3.0.
-
Field Details
-
type
The description of the nature of this geographic identifier, ornull
if unspecified.This field is non-final for sub-class constructors convenience, but its value should not be changed after
Location
construction.- See Also:
-
identifier
The geographic identifier, ornull
if unspecified.- See Also:
-
-
Constructor Details
-
AbstractLocation
Creates a new location for the given geographic identifier. This constructor acceptsnull
arguments, but this is not recommended.Upcoming API change — generalization
in a future SIS version, the type oftype
argument may be generalized to theorg.opengis.referencing.gazetteer.Location
interface. 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 ofLocationType
interface andAbstractLocationType
being package-private. We do not want to exposeAbstractLocationType
in 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
null
if 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 allowsnull
value. If non-null, SIS implementations typically provide instances of geographic bounding boxes.- Returns:
- description of the location instance, or
null
if 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
null
if 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
null
if 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.Location
interface. 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 ofLocationType
interface 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.Party
interface. 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.Location
interface. 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.Location
interface. 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.
-