ArcGIS Explorer Component Help |
Point..::.CreateFromLatitudeLongitude Method (Double, Double) |
Point Class Example See Also |
Creates a new Point from the specified latitude and longitude.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static Point CreateFromLatitudeLongitude( double latitude, double longitude ) |
Visual Basic (Declaration) |
---|
Public Shared Function CreateFromLatitudeLongitude ( _ latitude As Double, _ longitude As Double _ ) As Point |
Parameters
- latitude
- Type: System..::.Double
The latitude of the new Point.
- longitude
- Type: System..::.Double
The longitude of the new Point.
Return Value
A new Point with the specified location.Remarks
Generally, coordinate pairs are expressed with the X component first, then the Y (X, Y); this order is used throughout the ArcGIS Explorer API which is consistent with other ESRI APIs. However, coordinate pairs using geographical coordinate systems are often expressed with the latitude component first, then longitude (latitude, longitude); this format may be known as 'lat,long'. As the latitude is the Y component and longitude is the X component, this change in the coordinate order can cause confusion; in this case, you may find using this method as an alternative to the Point class constructors helpful.
Examples
The code below shows using the CreateFromLatitudeLongitude method on a Point class, compared to using a Point class constructor.
A Point object is created using both techniques; this demonstrates the difference in coordinate parameter order, showing that the
Point.X property relates to longitude, and the Point.Y property relates to latitude.
CopyC#
// The lat,long of Berlin, Germany in WGS 1984 coordinate system is 52.5006,13.3989 double berlinLat = 52.5006; double berlinLong = 13.3989; // Create a Point using CreateFromLatitudeLongitude. ESRI.ArcGISExplorer.Geometry.Point fromLatLong = ESRI.ArcGISExplorer.Geometry.Point.CreateFromLatitudeLongitude(berlinLat, berlinLong); // Create an equivalent Point using constructor. ESRI.ArcGISExplorer.Geometry.Point fromConstructor = new ESRI.ArcGISExplorer.Geometry.Point(berlinLong, berlinLat); // Check the two differently-created Points are equal. if (fromLatLong.Equals(fromConstructor)) { System.Diagnostics.Debug.WriteLine("Points are equal"); }
CopyVB.NET
' The lat,long of Berlin, Germany in WGS 1984 coordinate system is 52.5006,13.3989 Dim berlinLat As Double = 52.5006 Dim berlinLong As Double = 13.3989 ' Create a Point using CreateFromLatitudeLongitude. Dim fromLatLong As ESRI.ArcGISExplorer.Geometry.Point = ESRI.ArcGISExplorer.Geometry.Point.CreateFromLatitudeLongitude(berlinLat, berlinLong) ' Create an equivalent Point using constructor. Dim fromConstructor As ESRI.ArcGISExplorer.Geometry.Point = New ESRI.ArcGISExplorer.Geometry.Point(berlinLong, berlinLat) ' Check the two differently-created Points are equal. If (fromLatLong.Equals(fromConstructor)) Then System.Diagnostics.Debug.WriteLine("Points are equal") End If