Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########### C# file
- using Esri.ArcGISRuntime;
- using Esri.ArcGISRuntime.Data;
- using Esri.ArcGISRuntime.Geometry;
- using Esri.ArcGISRuntime.Mapping;
- using Esri.ArcGISRuntime.Location;
- using Esri.ArcGISRuntime.Xamarin.Forms.UI;
- using System;
- using Xamarin.Forms;
- namespace FieldEngineerLite.Views
- {
- public partial class TestGIS : ContentPage
- {
- public TestGIS()
- {
- InitializeComponent();
- Title = "Test GPS";
- // Create the UI, setup the control references and execute initialization
- Initialize();
- }
- private async void Initialize()
- {
- // Create new Map with basemap
- var myMap = new Map(Basemap.CreateTopographic());
- // Create envelope to be used as a target extent for map's initial viewpoint
- Envelope myEnvelope = new Envelope(
- -14260091.99687875, 2807349.5830308953,-7352630.624805781,6500786.789769631,
- SpatialReferences.WebMercator);
- // Set the initial viewpoint for map
- myMap.InitialViewpoint = new Viewpoint(myEnvelope);
- // Provide used Map to the MapView
- MyMapView.Map = myMap;
- //get location
- MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Default;
- MyMapView.LocationDisplay.Start();
- }
- }
- }
- #############XAML File
- <?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.UI;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
- xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
- xmlns:location="clr-namespace:Esri.ArcGISRuntime.Location;assembly=Esri.ArcGISRuntime"
- x:Class="FieldEngineerLite.Views.TestGIS">
- <Grid>
- <esriUI:MapView x:Name="MyMapView">
- <location:LocationDisplay
- AutoPanMode="Navigation"
- DefaultSymbol="{StaticResource NotMovingMarkerSym}" CourseSymbol="{StaticResource MovingMarkerSym}"
- IsEnabled="True" IsPingAnimationEnabled="True">
- </location:LocationDisplay>
- </esriUI:MapView>
- </Grid>
- </ContentPage>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement