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. Optionally, a z value (commonly used to describe elevation) and an m value can also be defined.

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 a given geometry is equal to this one within a given tolerance.
    boolean
    Tests if this object is equal to a second Geometry object.
    Gets the dimension of this 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
    Indicates if this Geometry has m values.
    boolean
    Indicates if this Geometry has z values.
    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 dimension of this Geometry, relating to the number of spatial dimensions in which the geometry may have a size.
      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
      Tests if this object is equal to a second Geometry object.

      This method is more stringent than the GeometryEngine.equals(Geometry, Geometry) method, as in addition to these checks, this method checks that each vertex in a Multipoint or Multipart geometry is in the same order; parts of Multiparts must also begin and end at the same Point.

      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 a given geometry is equal to this one within a given tolerance.

      This method performs a lightweight comparison of the geometries, such as 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.

      Returns true if the difference of each is within the tolerance and all other properties of the geometries are exactly equal (spatial reference, vertex count, etc.). A single tolerance is used even if the units for the horizontal coordinates and other values differ, for example horizontal coordinates in degrees and vertical coordinates in meters.

      This method 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.

      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
      Indicates if this Geometry has m values. M values are often referred to as measures, and are used in linear referencing workflows on linear datasets. NaN is a valid m value.

      If true, m values are stored for each vertex of the Geometry. Geometries with m values are created by using setters or constructors that take an m value as a parameter.

      Feature classes define whether their geometries have m values or not. When developing an editing workflow, you must ensure that this value matches that of the feature class in which the Geometry will be stored. The removeZ, removeM, and removeZAndM methods of GeometryEngine can be used to create new geometries without z- and m value from existing geometries that have the values. See the ArcGIS Desktop help topic Defining feature class properties for more information.

      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
      Indicates if this Geometry has z values. Z values are generally used as a z coordinate, indicating height or elevation. NaN is a valid z value.

      If true, z values are stored for each vertex of the Geometry. Geometries with z values are created by using setters or constructors that take a z value as a parameter.

      Feature classes define whether their geometries have z values or not. When developing an editing workflow, you must ensure that this value matches that of the feature class in which the Geometry will be stored. The removeZ, removeM, and removeZAndM methods of GeometryEngine can be used to create new geometries without z value and m value from existing geometries that have the values. See the ArcGIS Desktop help topic Defining feature class properties for more information.

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