Description
A location defined by an X- and Y- coordinate. It can be map units or screen units.
Samples
Search for
samples that use this class.
Class hierarchy
esri.geometry.Geometry
|_esri.geometry.Point
Constructors
| new Point(x,y,spatialReference) | Creates a new Point object using x, y, and a spatial reference. At version 3.3 if a spatial reference is not provided a default spatial reference of 4326 will be assigned. |
| new Point([x,y],spatialReference) | Creates a new Point object using an array containing an x,y coordinate value and a spatial reference. At version 3.3 if a spatial reference is not provided a default spatial reference of 4326 will be assigned. |
| new Point(json) | Creates a new Point object using a JSON object. |
| new Point(long,lat) | Create a point object and initialize it with the specified longitude and latitude. |
| new Point(point) | Create a point object and initialize it with an array containing longitude and latitude values. |
| new Point(point) | Create a point object and initialize it with an object that has latitude and longitude properties. |
Properties
Methods
| getLatitude() | Number | Returns the latitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326). |
| getLongitude() | Number | Returns the longitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326).
|
| offset(dx,dy) | Point | Offsets the point in an x and y direction. Units are map units. |
| setLatitude(lat) | Point | Sets the latitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326). |
| setLongitude(lon) | Point | Sets the longitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326).
|
| setSpatialReference(sr) | Geometry | Sets the spatial reference.
The return value of Geometry was added at v1.4. |
| setX(x) | Point | Sets x-coordinate of point.
The return value of Point was added at v1.4. |
| setY(y) | Point | Sets y-coordinate of point.
The return value of Point was added at v1.4. |
| toJson() | Object | Converts object to its ArcGIS Server JSON representation. |
| update(x,y) | Point | Updates a point. |
Constructor Details
new Point(x,y,spatialReference)
Creates a new Point object using x, y, and a spatial reference. At version 3.3 if a spatial reference is not provided a default spatial reference of 4326 will be assigned.
Parameters:
| <Number> x | Required | X-coordinate of a point in map units. |
| <Number> y | Required | Y-coordinate of a point in map units. |
| <SpatialReference> spatialReference | Required | Spatial reference of the geometry. |
Code Snippet:
require([
"esri/geometry/Point", "esri/SpatialReference", ...
], function(Point, SpatialReference, ... ) {
new Point(-118.15, 33.80, new SpatialReference({ wkid: 4326 }));
...
});
new Point([x,y],spatialReference)
Creates a new Point object using an array containing an x,y coordinate value and a spatial reference. At version 3.3 if a spatial reference is not provided a default spatial reference of 4326 will be assigned.
Parameters:
| <Array> [x,y] | Required | An array that includes an x,y coordinate. |
| <SpatialReference> spatialReference | Required | Spatial reference of the geometry. |
Code Snippet:
require([
"esri/geometry/Point", "esri/SpatialReference", ...
], function(Point, SpatialReference, ... ) {
var point = new Point([-122.65,45.53],new SpatialReference({ wkid:4326 }));
...
});
Creates a new Point object using a JSON object.
Parameters:
| <Object> json | Required | A JSON object that contains an x,y coordinate. |
Code Snippet:
require([
"esri/geometry/Point", ...
], function(Point, ... ) {
var point = new Point( {"x": -122.65, "y": 45.53, "spatialReference": {"wkid": 4326 } });
...
});
Create a point object and initialize it with the specified longitude and latitude.
Parameters:
| <Number> long | Required | Longitude value. |
| <Number> lat | Required | Latitude value. |
Code Snippet:
require([
"esri/geometry/Point", ...
], function(Point, ... ) {
var point = new Point(-98, 38);
...
});
Create a point object and initialize it with an array containing longitude and latitude values.
Parameters:
| <Number[]> point | Required | An input array containing the longitude and latitude values for the point. |
Code Snippet:
require([
"esri/geometry/Point", ...
], function(Point, ... ) {
var point = new Point([-98, 38]);
...
});
Create a point object and initialize it with an object that has latitude and longitude properties.
Parameters:
| <Object> point | Required | An object with latitude and longitude properties. |
Code Snippet:
require([
"esri/geometry/Point", ...
], function(Point, ... ) {
var point = new Point({
latitude: 38,
longitude: -98
});
...
});
Property Details
The type of geometry.
Known Values: point | multipoint | polyline | polygon | extent
X-coordinate of a point in map units.
Y-coordinate of a point in map units.
Method Details
Returns the latitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326).
Return Value: Number
Returns the longitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326).
Return Value: Number
Offsets the point in an x and y direction. Units are map units.
Input Parameters:
| <Number> dx | Required | Value for x-coordinate of point. |
| <Number> dy | Required | Value for y-coordinate of point. |
Sets the latitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326).
Input Parameters:
| <Number> lat | Required | Valid latitude value. |
Sets the longitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326).
Input Parameters:
| <Number> lon | Required | A valid longitude value. |
Sets the spatial reference.
The return value of Geometry was added at v1.4.
Input Parameters:
Sets x-coordinate of point.
The return value of Point was added at v1.4.
Input Parameters:
| <Number> x | Required | Value for x-coordinate of point. |
Sets y-coordinate of point.
The return value of Point was added at v1.4.
Input Parameters:
| <Number> y | Required | Value for y-coordinate of point. |
Converts object to its ArcGIS Server JSON representation.
Return Value: Object
Updates a point.
Input Parameters:
| <Number> x | Required | X-coordinate of the updated point. |
| <Number> y | Required | Y-coordinate of the updated point. |