Click or drag to resize

MapPoint Class

Map coordinate
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Geometry
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.6.0.0
Syntax
C#
public class MapPoint : Geometry

The MapPoint type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleMapPoint(Double, Double)
Initializes a new instance of the MapPoint class.
Public methodCode exampleMapPoint(Double, Double, SpatialReference)
Initializes a new instance of the MapPoint class.
Public methodCode exampleMapPoint(Double, Double, Double)
Initializes a new instance of the MapPoint class.
Public methodCode exampleMapPoint(Double, Double, Double, SpatialReference)
Initializes a new instance of the MapPoint class.
Top
Properties
  NameDescription
Public propertyDimension
Gets the number of dimensions for the geometry.
(Overrides GeometryDimension.)
Public propertyExtent
Gets the minimum enclosing envelope of the instance
(Overrides GeometryExtent.)
Public propertyGeometryType
Gets the geometry type.
(Overrides GeometryGeometryType.)
Public propertyHasCurves
Gets a value indicating whether the geometry has any curves.
(Inherited from Geometry.)
Public propertyHasM
Gets a value indicating if the geometry has M
(Overrides GeometryHasM.)
Public propertyHasZ
Gets a value indicating if the geometry has Z coordinate.
(Overrides GeometryHasZ.)
Public propertyIsEmpty
Gets a value indicating whether or not the geometry is empty.
(Overrides GeometryIsEmpty.)
Public propertyM
Gets the measure value.
Public propertyCode exampleSpatialReference
Gets the spatial reference of this geometry.
(Inherited from Geometry.)
Public propertyCode exampleX
Gets the X coordinate.
Public propertyCode exampleY
Gets the Y coordinate
Public propertyCode exampleZ
Gets the Z coordinate.
Top
Methods
  NameDescription
Public methodStatic memberCreateWithM(Double, Double, Double)
Creates a new 2D map point with an M (measure) value. The spatial reference will be null.
Public methodStatic memberCreateWithM(Double, Double, Double, SpatialReference)
Creates a new 2D map point with an M (measure) value and a spatial reference.
Public methodStatic memberCreateWithM(Double, Double, Double, Double)
Creates a new 3D map point with an Z and M (measure) values.
Public methodStatic memberCreateWithM(Double, Double, Double, Double, SpatialReference)
Creates a new 3D map point with an Z and M (measure) values.
Public methodEquals
Checks if two geometries are approximately same, within some tolerance.
(Inherited from Geometry.)
Public methodIsEqual
Compares two MapPoint for equality. This will check for a matching SpatialReference and coordinates for a match.
(Overrides GeometryIsEqual(Geometry).)
Public methodToJson
Converts this geometry into an ArcGIS JSON representation.
(Inherited from Geometry.)
Public methodToString
Returns a String that represents the current Object.
(Overrides ObjectToString.)
Top
Remarks

MapPoints are based upon the parent Geometry Class. The Geometry Class is immutable which means that you can not change its shape once it is created. If you need to modify a MapPoint once it has been created, use the MapPointBuilder Class instead. The ToGeometry Method will provide you with the MapPoint object.

Examples

Android

Example Name: AddAnIntegratedMeshLayer

View an integrated mesh layer from a scene service.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Android.App;
using Android.OS;
using Android.Widget;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.UI.Controls;
using System;

namespace ArcGISRuntimeXamarin.Samples.AddAnIntegratedMeshLayer
{
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Add an integrated mesh layer",
        "Layers",
        "View an integrated mesh layer from a scene service.",
        "")]
    public class AddAnIntegratedMeshLayer : Activity
    {
        // Create and hold reference to the used MapView.
        private readonly SceneView _mySceneView = new SceneView();

        // URLs for the services used by this sample.
        private const string IntegratedMeshLayerUrl =
            "https://tiles.arcgis.com/tiles/FQD0rKU8X5sAQfh8/arcgis/rest/services/VRICON_Yosemite_Sample_Integrated_Mesh_scene_layer/SceneServer";

        private const string ElevationServiceUrl = "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = "Add an integrated mesh layer";

            CreateLayout();
            Initialize();
        }

        private void Initialize()
        {
            // Create the scene with basemap.
            _mySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Create and use an elevation surface to show terrain.
            Surface baseSurface = new Surface();
            baseSurface.ElevationSources.Add(new ArcGISTiledElevationSource(new Uri(ElevationServiceUrl)));
            _mySceneView.Scene.BaseSurface = baseSurface;

            // Create the integrated mesh layer from URL.
            IntegratedMeshLayer meshLayer = new IntegratedMeshLayer(new Uri(IntegratedMeshLayerUrl));

            // Add the layer to the scene's operational layers.
            _mySceneView.Scene.OperationalLayers.Add(meshLayer);

            // Start with camera pointing at El Capitan.
            _mySceneView.SetViewpointCamera(new Camera(new MapPoint(-119.622075, 37.720650, 2104.901239), 315.50368761552056, 78.09465920130114, 0));
        }

        private void CreateLayout()
        {
            // Create a new vertical layout for the app.
            var layout = new LinearLayout(this) {Orientation = Orientation.Vertical};

            // Add the map view to the layout.
            layout.AddView(_mySceneView);

            // Show the layout in the app.
            SetContentView(layout);
        }
    }
}
Examples

Xamarin Forms Android

Example Name: Project

Project a point from one spatial reference to another.

Code example screen shot.

C#
// Copyright 2019 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Xamarin.Forms;

namespace ArcGISRuntimeXamarin.Samples.Project
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Project",
        "Geometry",
        "Project a point to another spatial reference.",
        "")]
    public partial class Project : ContentPage
    {
        public Project()
        {
            InitializeComponent();
            Initialize();
        }

        private async void Initialize()
        {
            // Show a map in the default WebMercator spatial reference.
            MyMapView.Map = new Map(Basemap.CreateNationalGeographic());

            // Add a graphics overlay for showing the tapped point.
            GraphicsOverlay overlay = new GraphicsOverlay();
            SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Red, 5);
            overlay.Renderer = new SimpleRenderer(markerSymbol);
            MyMapView.GraphicsOverlays.Add(overlay);

            // Respond to user taps.
            MyMapView.GeoViewTapped += MapView_Tapped;

            // Zoom to Minneapolis.
            Envelope startingEnvelope = new Envelope(-10995912.335747, 5267868.874421, -9880363.974046, 5960699.183877,
                SpatialReferences.WebMercator);
            await MyMapView.SetViewpointGeometryAsync(startingEnvelope);
        }

        private void MapView_Tapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e)
        {
            // Get the tapped point - this is in the map's spatial reference,
            // which in this case is WebMercator because that is the SR used by the included basemaps.
            MapPoint tappedPoint = e.Location;

            // Update the graphics.
            MyMapView.GraphicsOverlays[0].Graphics.Clear();
            MyMapView.GraphicsOverlays[0].Graphics.Add(new Graphic(tappedPoint));

            // Project the point to WGS84
            MapPoint projectedPoint = (MapPoint) GeometryEngine.Project(tappedPoint, SpatialReferences.Wgs84);

            // Format the results in strings.
            string originalCoords = $"Original: {tappedPoint.X:F4}, {tappedPoint.Y:F4}";
            string projectedCoords = $"Projected: {projectedPoint.X:F4}, {projectedPoint.Y:F4}";

            // Define a callout and show it in the map view.
            CalloutDefinition calloutDef = new CalloutDefinition(projectedCoords, originalCoords);
            MyMapView.ShowCalloutAt(tappedPoint, calloutDef);
        }
    }
}
XAML
<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             x:Class="ArcGISRuntimeXamarin.Samples.Project.Project">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
    </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddAnIntegratedMeshLayerView an integrated mesh layer from a scene service.
AddFeaturesAdd features to a feature layer.
AddGraphicsRendererChange the style of all graphics in a graphics overlay by referencing a single symbol style.
AddGraphicsWithSymbolsUse a symbol style to display a graphic on a graphics overlay.
AnalyzeViewshedCalculate a viewshed using a geoprocessing service, in this case showing what parts of a landscape are visible from points on mountainous terrain.
Animate3DGraphicAn `OrbitGeoElementCameraController` follows a graphic while the graphic's position and rotation are animated.
BufferCreate a buffer around a map point and display the results as a `Graphic`
BufferListGenerate multiple individual buffers or a single unioned buffer around multiple points.
ChangeViewpointSet the map view to a new viewpoint.
ChooseCameraControllerControl the behavior of the camera in a scene.
ClipGeometryClip a geometry with another geometry.
ClosestFacilityFind a route to the closest facility from a location.
ClosestFacilityStaticFind routes from several locations to the respective closest facility.
ConvexHullCreate a convex hull for a given set of points. The convex hull is a polygon with shortest perimeter that encloses a set of points. As a visual analogy, consider a set of points as nails in a board. The convex hull of the points would be like a rubber band stretched around the outermost nails.
ConvexHullListThis sample demonstrates how to use the GeometryEngine.ConvexHull to generate convex hull polygon(s) from multiple input geometries.
CreateFeatureCollectionLayerCreate a Feature Collection Layer from a Feature Collection Table, and add it to a map.
CreateGeometriesCreate simple geometry types.
CutGeometryCut a geometry along a polyline.
DeleteFeaturesDelete features from an online feature service.
DensifyAndGeneralizeA multipart geometry can be densified by adding interpolated points at regular intervals. Generalizing multipart geometry simplifies it while preserving its general shape. Densifying a multipart geometry adds more vertices at regular intervals.
DisplayGridDisplay coordinate system grids including Latitude/Longitude, MGRS, UTM and USNG on a map view. Also, toggle label visibility and change the color of grid lines and grid labels.
DisplayKmlNetworkLinks Display a file with a KML network link.
DisplayLayerViewStateView the status of the layers on the map.
DisplayWfsDisplay a layer from a WFS service, requesting only features for the current extent.
DistanceMeasurementMeasure distances between two points in 3D.
EditAndSyncFeaturesSynchronize offline edits with a feature service.
EditFeatureAttachmentsAdd, delete, and download attachments for features from a service.
FeatureLayerDefinitionExpressionLimit the features to display on the map using a definition expression.
FeatureLayerExtrusionExtrude features based on their attributes.
FeatureLayerQueryFind features in a feature table which match an SQL query.
FeatureLayerRenderingModeMapRender features statically or dynamically by setting the feature layer rendering mode.
FeatureLayerRenderingModeSceneRender features in a scene statically or dynamically by setting the feature layer rendering mode.
FeatureLayerSelectionSelect features in a feature layer.
FeatureLayerUrlShow a feature layer on a map using the URL to the service.
FindAddressFind the location for an address.
FindPlaceFind places of interest near a location or within a specific area.
FindRouteDisplay directions for a route between two points.
FindServiceAreaFind the service area within a network from a given point.
FormatCoordinatesFormat coordinates in a variety of common notations.
GeodatabaseTransactionsThis sample demonstrates how to manage edits to a local geodatabase inside of transactions.
GeodesicOperationsThis sample demonstrates how to perform geodesic operations on geometries using the GeometryEngine. Geodesic calculations take into account the curvature of the Earth, while planar calculations are based on a 2D Cartesian plane.
GetElevationAtPointGet the elevation for a given point on a surface in a scene.
IdentifyGraphicsDisplay an alert message when a graphic is clicked.
IdentifyLayersIdentify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.
LineOfSightGeoElementShow a line of sight between two moving objects.
LineOfSightLocationPerform a line of sight analysis between two points in real time.
ListKmlContentsList the contents of a KML file. KML files can contain a hierarchy of features, including network links to other KML content.
ListTransformationsGet a list of suitable transformations for projecting a geometry between two spatial references with different horizontal datums.
MapImageLayerTablesFind features in a spatial table related to features in a non-spatial table.
MapImageSublayerQueryFind features in a sublayer based on attributes and location.
MobileMapSearchAndRouteDisplay maps and use locators to enable search and routing offline using a Mobile Map Package.
NearestVertexShows how to find the nearest vertex on a geometry to a given point.
OfflineGeocodeGeocode addresses to locations and reverse geocode locations to addresses offline.
OfflineRoutingSolve a route on-the-fly using offline data.
ProjectProject a point from one spatial reference to another.
ProjectWithSpecificTransformationThis sample demonstrates how to use the GeometryEngine with a specified geographic transformation to transform a geometry from one coordinate system to another.
RasterLayerImageServiceRasterCreate a raster layer from a raster image service.
RenderPictureMarkersUse pictures for markers.
RenderSimpleMarkersShow a simple marker symbol on a map.
ReverseGeocodeUse an online service to find the address for a tapped point.
RouteAroundBarriersFind a route that reaches all stops without crossing any barriers.
SceneLayerSelectionIdentify GeoElements in a scene layer.
SceneLayerUrlDisplay an ArcGIS scene layer from a URL.
ScenePropertiesExpressionsUpdate the orientation of a graphic using scene property rotation expressions.
SceneSymbolsShow various kinds of 3D symbols in a scene.
SelectEncFeaturesSelect features in an ENC layer.
ServiceFeatureTableManualCacheDisplay a feature layer from a service using the **manual cache** feature request mode.
SetMinMaxScaleRestrict zooming between specific scale ranges.
ShowCalloutShow a callout with the latitude and longitude of user-tapped points.
ShowLabelsOnLayerDisplay custom labels on a feature layer.
ShowLocationHistoryDisplay your location history on the map.
SimpleRenderersDisplay common symbols for all graphics in a graphics overlay with a renderer.
SketchOnMapUse the Sketch Editor to edit or sketch a new point, line, or polygon geometry on to a map.
SpatialOperationsFind the union, intersection, or difference of two geometries.
SpatialRelationshipsDetermine spatial relationships between two geometries.
SurfacePlacementsPosition graphics relative to a surface using different surface placement modes.
SymbolizeShapefileDisplay a shapefile with custom symbology.
SymbolsFromMobileStyleOpen a mobile style (.stylx) and read its contents. Combine several symbols from the style into a single multilayer point symbol, then use it to display graphics in the map view.
TerrainExaggerationConfigure the vertical exaggeration of terrain (the ground surface) in a scene.
UpdateAttributesUpdate feature attributes in an online feature service.
UpdateGeometriesUpdate a feature's location in an online feature service.
UseDistanceCompositeSymChange a graphic's symbol based on the camera's proximity to it.
ViewshedCameraAnalyze the viewshed for a camera. A viewshed shows the visible and obstructed areas from an observer's vantage point.
ViewshedGeoElementAnalyze the viewshed for an object (GeoElement) in a scene.
ViewshedLocationPerform a viewshed analysis from a defined vantage point. Viewshed analyses have several configuration options that are demonstrated in this sample.