public final class GeoUri
extends java.lang.Object
Represents a URI for encoding a geographical position.
Example geo URI: geo:40.714623,-74.006605
This class is immutable. Use the GeoUri.Builder
object to construct a new
instance, or the parse(java.lang.String)
method to parse a geo URI string.
Examples:
GeoUri uri = new GeoUri.Builder(40.714623, -74.006605).coordC(1.1).build(); GeoUri uri = GeoUri.parse("geo:40.714623,-74.006605,1.1"); GeoUri copy = new GeoUri.Builder(original).coordC(2.1).build();
Modifier and Type | Class and Description |
---|---|
static class |
GeoUri.Builder
Builder class for
GeoUri . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CRS_WGS84
The coordinate reference system used by GPS (the default).
|
Modifier and Type | Method and Description |
---|---|
java.lang.Double |
getCoordA()
Gets the first coordinate (latitude).
|
java.lang.Double |
getCoordB()
Gets the second coordinate (longitude).
|
java.lang.Double |
getCoordC()
Gets the third coordinate (altitude).
|
java.lang.String |
getCrs()
Gets the coordinate reference system.
|
java.lang.String |
getParameter(java.lang.String name)
Gets a parameter value.
|
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
Gets all the parameters.
|
java.lang.Double |
getUncertainty()
Gets the uncertainty (how accurate the coordinates are).
|
static GeoUri |
parse(java.lang.String uri)
Parses a geo URI string.
|
java.lang.String |
toString()
Converts this geo URI to its string representation.
|
java.lang.String |
toString(int decimals)
Converts this geo URI to its string representation.
|
java.net.URI |
toUri()
Creates a
URI object from this geo URI. |
public static final java.lang.String CRS_WGS84
public static GeoUri parse(java.lang.String uri)
uri
- the URI string (e.g. "geo:40.714623,-74.006605")java.lang.IllegalArgumentException
- if the string is not a valid geo URIpublic java.lang.Double getCoordA()
public java.lang.Double getCoordB()
public java.lang.Double getCoordC()
public java.lang.String getCrs()
public java.lang.Double getUncertainty()
public java.lang.String getParameter(java.lang.String name)
name
- the parameter namepublic java.util.Map<java.lang.String,java.lang.String> getParameters()
public java.net.URI toUri()
URI
object from this geo URI.URI
objectpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int decimals)
decimals
- the number of decimals to display for floating point
valuesThis software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.