java.lang.Object
com.esri.arcgisruntime.geometry.Geometry
com.esri.arcgisruntime.geometry.Point
All Implemented Interfaces:
JsonSerializable

public final class Point extends Geometry
A location defined by x and y (and optionally z) coordinates.

Point geometries represent discrete locations or entities, such as a geocoded house address, the location of a water meter in a water utility network, a moving vehicle, and so on. Larger geographic entities (such as cities) are often represented as points on small-scale maps. Points can be used as the geometry of features and graphics and are often used to construct more complex geometries. They are also used in a Viewpoint to define the center of the display.

Points store a single set of x,y coordinates that define a location (longitude and latitude, for example), and a SpatialReference. Points can optionally have a getZ() (elevation or altitude) and getM() (measure) attributes.

For points defined with a geographic spatial reference, the x coordinate is the longitude (east or west), and the y coordinate is the latitude (north or south). When geographic coordinates are represented in strings, points are generally written using the form "(latitude, longitude)", where the y coordinate comes before the x coordinate. Latitude values south of the equator and longitude values west of the prime meridian are expressed as negative numbers.

Use CoordinateFormatter to convert a latitude, longitude formatted string directly to a Point, and also return a latitude, longitude formatted string from an existing Point. Other coordinate notations, such as Military Grid Reference System (MGRS) and United States National Grid (USNG) are also supported.

The SpatialReference of a Point will be null if one is not set in its constructor; if subsequently added to a PointCollection, it will take on the SpatialReference of that PointCollection. Point is immutable. Instead of changing the properties of an existing Point, create new Point instances, or use PointBuilder.

A Point can be used as the geometry of a Feature or Graphic, and also when setting the viewpoint of a MapView using setViewpointGeometryAsync or setViewpointCenterAsync.

Since:
100.0.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Point(double x, double y)
    Creates a new immutable Point with the given x and y coordinates.
    Point(double x, double y, double z)
    Creates a new immutable Point with the given x,y coordinates and z value.
    Point(double x, double y, double z, SpatialReference spatialReference)
    Creates a new immutable Point with the given x,y coordinates, z value, and SpatialReference.
    Point(double x, double y, SpatialReference spatialReference)
    Creates a new immutable Point with the given x,y coordinates and SpatialReference.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Point
    createWithM(double x, double y, double m)
    Creates a new immutable Point with the given x,y coordinates, and m value.
    static Point
    createWithM(double x, double y, double z, double m)
    Creates a new immutable Point with the given x,y coordinates, z value, and m value.
    static Point
    createWithM(double x, double y, double z, double m, SpatialReference spatialReference)
    Creates a new immutable Point with the given x,y coordinates, z value, m value, and SpatialReference.
    static Point
    createWithM(double x, double y, double m, SpatialReference spatialReference)
    Creates a new immutable Point with the given x,y coordinates, m value, and SpatialReference.
    boolean
    equals(Geometry geometry, double tolerance)
    Checks if two geometries are approximately the same within the given tolerance.
    boolean
    Checks if two geometries are exactly equal.
    Gets the dimensionality of a Geometry, relating to the number of spatial dimensions in which the geometry may have a size.
    Gets the type of this Geometry, indicating the subclass, and the type of geometrical shape it can represent.
    double
    Gets the m value of this Point.
    double
    Gets the x coordinate of this Point.
    double
    Gets the y coordinate of this Point.
    double
    Gets the z value of this PointPoint.
    int
    Generates a hash value from the Geometry.
    boolean
    True if the geometry has m values (measure values), false otherwise.
    boolean
    True if the geometry has z-coordinate values, false otherwise.
    Returns a string representation of this Point instance.

    Methods inherited from class com.esri.arcgisruntime.geometry.Geometry

    fromJson, fromJson, getExtent, getSpatialReference, getUnknownJson, getUnsupportedJson, hasCurves, isEmpty, toJson

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Point

      public Point(double x, double y)
      Creates a new immutable Point with the given x and y coordinates.
      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      Since:
      100.0.0
    • Point

      public Point(double x, double y, SpatialReference spatialReference)
      Creates a new immutable Point with the given x,y coordinates and SpatialReference.
      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      spatialReference - the spatial reference of the new Point, and of the x and y parameters
      Since:
      100.0.0
    • Point

      public Point(double x, double y, double z)
      Creates a new immutable Point with the given x,y coordinates and z value.

      The minimum z value is -6,356,752 meters, which is the approximate radius of the earth (the WGS 84 datum semi-minor axis). The maximum z value is 55,000,000 meters.

      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      z - the z value of the new Point
      Since:
      100.0.0
    • Point

      public Point(double x, double y, double z, SpatialReference spatialReference)
      Creates a new immutable Point with the given x,y coordinates, z value, and SpatialReference.

      The minimum z value is -6,356,752 meters, which is the approximate radius of the earth (the WGS 84 datum semi-minor axis). The maximum z value is 55,000,000 meters.

      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      z - the z value of the new Point
      spatialReference - the spatial reference of the new Point, and of the x and y parameters
      Since:
      100.0.0
  • Method Details

    • createWithM

      public static Point createWithM(double x, double y, double m)
      Creates a new immutable Point with the given x,y coordinates, and m value. The new Point has a null SpatialReference.
      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      m - the m value of the new Point
      Returns:
      new Point
      Since:
      100.0.0
    • createWithM

      public static Point createWithM(double x, double y, double m, SpatialReference spatialReference)
      Creates a new immutable Point with the given x,y coordinates, m value, and SpatialReference.
      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      m - the m value of the new Point
      spatialReference - the spatial reference of the new Point, and of the x and y parameters
      Returns:
      new Point
      Since:
      100.0.0
    • createWithM

      public static Point createWithM(double x, double y, double z, double m)
      Creates a new immutable Point with the given x,y coordinates, z value, and m value. The new Point has a null SpatialReference.

      The minimum z value is -6,356,752 meters, which is the approximate radius of the earth (the WGS 84 datum semi-minor axis). The maximum z value is 55,000,000 meters.

      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      z - the z value of the new Point
      m - the m value of the new Point
      Returns:
      new Point
      Since:
      100.0.0
    • createWithM

      public static Point createWithM(double x, double y, double z, double m, SpatialReference spatialReference)
      Creates a new immutable Point with the given x,y coordinates, z value, m value, and SpatialReference.

      The minimum z value is -6,356,752 meters, which is the approximate radius of the earth (the WGS 84 datum semi-minor axis). The maximum z value is 55,000,000 meters.

      Parameters:
      x - the x coordinate of the new Point
      y - the y coordinate of the new Point
      z - the z value of the new Point
      m - the m value of the new Point
      spatialReference - the spatial reference of the new Point, and of the x and y parameters
      Returns:
      new Point
      Since:
      100.0.0
    • getX

      public double getX()
      Gets the x coordinate of this Point. The Geometry.getSpatialReference() determines the coordinate units.

      If the SpatialReference is a geographic coordinate system, the x coordinate defines longitude, and the units will be angular.

      Returns:
      the x coordinate of this Point
      Since:
      100.0.0
    • getY

      public double getY()
      Gets the y coordinate of this Point. The Geometry.getSpatialReference() determines the coordinate units.

      If the SpatialReference is a geographic coordinate system, the y coordinate defines latitude, and the units will be angular.

      Returns:
      the y coordinate of this Point
      Since:
      100.0.0
    • getZ

      public double getZ()
      Gets the z value of this PointPoint.

      Geometries can have z values, indicating values along the z-axis, which is perpendicular to both the x-axis and y-axis. Z values indicate height above or depth below a surface, or an absolute elevation. For example, z values are used to draw the locations of geometries in a SceneView Note that geometries are not considered true 3D shapes and are draped onto surfaces in the view, or in some cases, drawn in a single plane by using z values. Z values are stored on Point and Envelope. Since Multipoint, Polyline, and Polygon are created from a collection of Point, all types of geometry can have z values.

      Whether or not a geometry has z values is determined when the geometry is created; if you use a method that has a z value parameter, the new geometry will have z values (Geometry.hasZ() will be true). If you create geometries using constructors that take z value parameters, or if you pass into the constructor points or segments that have z values, the new geometry will have z values. A Geometry with z values is sometimes known as a z-aware geometry.

      It may be that not all vertices in your geometry have a z value defined. NAN is a valid z value used to indicate an unknown z value. However, the default z value is 0. When you get z values from a geometry that does not have z values, the default is 0. Check the Geometry.hasZ() to determine whether a z value of 0 means that there are no z values in the geometry or that the z value in the geometry's coordinates really is 0.

      Returns:
      the z value of this Point
      Since:
      100.0.0
    • getM

      public double getM()
      Gets the m value of this Point. M values do not have specific units.

      M values are also known as measures. M values are used in linear referencing scenarios and may represent things like mile markers along a highway. Like z values, every geometry can optionally store m values with the point coordinates that comprise it. The default m value is NaN. If an m value is specified when a geometry is created, the new geometry will have m values (Geometry.hasM() will be true). Note that when you get m values back from a geometry, the default value of NAN is returned for vertices that do not have m values. A geometry with m values is sometimes known as an m-aware geometry.

      Returns:
      the m value of this Point
      Since:
      100.0.0
    • getDimension

      public GeometryDimension getDimension()
      Description copied from class: Geometry
      Gets the dimensionality of a Geometry, relating to the number of spatial dimensions in which the geometry may have a size.

      You can use Geometry.getDimension() to work out what kind of symbol can be applied to a specific type of geometry. For example, Point and Multipoint are both zero-dimensional point geometries, and both can be displayed using a type of MarkerSymbol. Polygon and Envelope are both 2-dimensional area geometries that can be displayed using a type of FillSymbol.

      Returns GeometryDimension.UNKNOWN if an error occurs.

      Overrides:
      getDimension in class Geometry
      Returns:
      the dimension of this Geometry
    • getGeometryType

      public GeometryType getGeometryType()
      Description copied from class: Geometry
      Gets the type of this Geometry, indicating the subclass, and the type of geometrical shape it can represent.
      Overrides:
      getGeometryType in class Geometry
      Returns:
      the type of this Geometry
    • equals

      public boolean equals(Object obj)
      Description copied from class: Geometry
      Checks if two geometries are exactly equal. The types of geometry, order of points, all values, and the SpatialReference must all be equal.

      This method provides a strict comparison of two geometries to ensure that they are identical. For a slightly more relaxed comparison (one that does not take coordinate order into account), use GeometryEngine.equals(Geometry, Geometry).

      Overrides:
      equals in class Geometry
      Parameters:
      obj - the second geometry
      Returns:
      true if the comparison succeeds and the objects are equal, false otherwise
    • equals

      public boolean equals(Geometry geometry, double tolerance)
      Description copied from class: Geometry
      Checks if two geometries are approximately the same within the given tolerance.

      This function performs a lightweight comparison of two geometries that might be useful when writing test code. It uses the tolerance to compare each of x, y, and any other values the geometries possess (such as z or m) independently in the manner: abs(value1 - value2) <= tolerance. The single tolerance value is used even if the x, y, z or m units differ. This function does not respect modular arithmetic of spatial references which wrap around, so longitudes of -180 and +180 degrees are considered to differ by 360 degrees.

      Returns true if the difference of each is within the tolerance and all other properties of the geometries are exactly equal (such as spatial reference and vertex count). Returns false if an error occurs.

      For topological equality, use a relational operator such as GeometryEngine.equals(Geometry, Geometry).

      Overrides:
      equals in class Geometry
      Parameters:
      geometry - the geometry to check
      tolerance - the tolerance
      Returns:
      true if the geometries are equal, within the tolerance, otherwise false
      See Also:
    • hashCode

      public int hashCode()
      Description copied from class: Geometry
      Generates a hash value from the Geometry.
      Overrides:
      hashCode in class Geometry
      Returns:
      a hash value based on the current Geometry
    • toString

      public String toString()
      Returns a string representation of this Point instance. The format and content of this string is subject to change without notice.

      This value may be useful for debugging purposes, but cannot be relied upon for persistence purposes.

      Overrides:
      toString in class Object
      Since:
      100.0.0
      See Also:
    • hasM

      public boolean hasM()
      Description copied from class: Geometry
      True if the geometry has m values (measure values), false otherwise.

      M is a vertex value that is stored with the geometry. These values typically represent non-spatial measurements or attributes.

      Overrides:
      hasM in class Geometry
      Returns:
      true if this Geometry has m values; false otherwise
      See Also:
    • hasZ

      public boolean hasZ()
      Description copied from class: Geometry
      True if the geometry has z-coordinate values, false otherwise.

      Only 3D geometries contain z-coordinate values. These values typically represent elevation, height, or depth.

      Overrides:
      hasZ in class Geometry
      Returns:
      true if this Geometry has z values; false otherwise
      See Also: