Class Point
- java.lang.Object
-
- com.github.filosganga.geogson.model.AbstractGeometry<SinglePosition>
-
- com.github.filosganga.geogson.model.Point
-
- All Implemented Interfaces:
Geometry<SinglePosition>,Serializable
public class Point extends AbstractGeometry<SinglePosition>
A Point is identified by a lon,lat and alt coordinate..GeoJson reference: @see http://geojson.org/geojson-spec.html#point.
eg:
Point p1 = Point.from(1,2); Point p2 = Point.from(1, 2, 3); <p>- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.filosganga.geogson.model.Geometry
Geometry.Type
-
-
Constructor Summary
Constructors Constructor Description Point(SinglePosition positions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublealt()The z-axis coordinate in map units (degree, kilometer, meter, mile, foot and inch).static Pointfrom(double lon, double lat)Create a Point from the given coordinates.static Pointfrom(double lon, double lat, double alt)Create a Point from the given coordinates.doublelat()The y-axis coordinate in map units (degree, kilometer, meter, mile, foot and inch).doublelon()The x-axis coordinate in map units (degree, kilometer, meter, mile, foot and inch).Geometry.Typetype()Returns the Geometry type.PointwithAlt(double alt)Returns a new Point instance with the given z-axis value.PointwithLat(double lat)Returns a new Point instance with the given x-axis value.PointwithLon(double lon)Returns a new Point instance with the given x-axis value.
-
-
-
Constructor Detail
-
Point
public Point(SinglePosition positions)
-
-
Method Detail
-
from
public static Point from(double lon, double lat)
Create a Point from the given coordinates.- Parameters:
lon- The x axis value. Longitude in a geographic projection.lat- The y axis value. Latitude in a geographic projection.- Returns:
- Point instance.
-
from
public static Point from(double lon, double lat, double alt)
Create a Point from the given coordinates.- Parameters:
lon- The x axis value. Longitude in a geographic projection.lat- The y axis value. Latitude in a geographic projection.alt- The z axis value. Altitude in a geographic projection.- Returns:
- Point instance.
-
lon
public double lon()
The x-axis coordinate in map units (degree, kilometer, meter, mile, foot and inch). If your map is in a geographic projection, this will be the Longitude. Otherwise, it will be the x coordinate of the map location in your map units.- Returns:
- the x-axis value of this point.
-
lat
public double lat()
The y-axis coordinate in map units (degree, kilometer, meter, mile, foot and inch). If your map is in a geographic projection, this will be the Latitude. Otherwise, it will be the y coordinate of the map location in your map units.- Returns:
- the y-axis value of this point.
-
alt
public double alt()
The z-axis coordinate in map units (degree, kilometer, meter, mile, foot and inch). If your map is in a geographic projection, this will be the Altitude. Otherwise, it will be the z coordinate of the map location in your map units.- Returns:
- the z-axis value of this point.
-
withLon
public Point withLon(double lon)
Returns a new Point instance with the given x-axis value.- Parameters:
lon- The new longitude value.- Returns:
- A Point instance with this instance latitude and the given longitude
-
withLat
public Point withLat(double lat)
Returns a new Point instance with the given x-axis value.- Parameters:
lat- The new latitude value.- Returns:
- A Point instance with this instance longitude and the given latitude.
-
withAlt
public Point withAlt(double alt)
Returns a new Point instance with the given z-axis value.- Parameters:
alt- The new latitude value.- Returns:
- A Point instance with this instance longitude and the given latitude.
-
type
public Geometry.Type type()
Description copied from interface:GeometryReturns the Geometry type.- Returns:
- Type
-
-