Class Point

  • All Implemented Interfaces:
    JsonSerializable

    public final class Point
    extends Geometry
    Represents a specific location, defined by an x,y coordinate pair, and a SpatialReference.

    Points can optionally have z (height) and m (measure) values; if not specifically set, these values will be NaN. If the SpatialReference is a geographic coordinate system, the x-coordinate defines longitude and the y-coordinate defines latitude. 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 or setViewpointCenterAsync.

    Since:
    100.0.0
    See Also:
    PointBuilder
    • 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.
    • Constructor Detail

      • 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.
        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.
        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 Detail

      • 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.
        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.
        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 Point.

        Z-values are used as z-coordinates when displayed in 3D. The vertical coordinate system component of the Geometry.getSpatialReference() determines the units in this case.

        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, and are used in linear referencing functions.

        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

        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
      • 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:
        Geometry.equals(Object)
      • 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:
        Geometry.toJson()
      • 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:
        Geometry.hasZ(), GeometryEngine.removeM(Geometry), GeometryEngine.removeZ(Geometry), GeometryEngine.removeZAndM(Geometry)
      • 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- 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:
        Geometry.hasM(), GeometryEngine.removeM(Geometry), GeometryEngine.removeZ(Geometry), GeometryEngine.removeZAndM(Geometry)