public final class GeoUri extends 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 String |
CRS_WGS84
The coordinate reference system used by GPS (the default).
|
Modifier and Type | Method and Description |
---|---|
Double |
getCoordA()
Gets the first coordinate (latitude).
|
Double |
getCoordB()
Gets the second coordinate (longitude).
|
Double |
getCoordC()
Gets the third coordinate (altitude).
|
String |
getCrs()
Gets the coordinate reference system.
|
String |
getParameter(String name)
Gets a parameter value.
|
Map<String,String> |
getParameters()
Gets all the parameters.
|
Double |
getUncertainty()
Gets the uncertainty (how accurate the coordinates are).
|
static GeoUri |
parse(String uri)
Parses a geo URI string.
|
String |
toString()
Converts this geo URI to its string representation.
|
String |
toString(int decimals)
Converts this geo URI to its string representation.
|
URI |
toUri()
Creates a
URI object from this geo URI. |
public static final String CRS_WGS84
public static GeoUri parse(String uri)
uri
- the URI string (e.g. "geo:40.714623,-74.006605")IllegalArgumentException
- if the string is not a valid geo URIpublic Double getCoordA()
public Double getCoordB()
public Double getCoordC()
public String getCrs()
public Double getUncertainty()
public String getParameter(String name)
name
- the parameter namepublic Map<String,String> getParameters()
public String toString()
public 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.