GithubHelp home page GithubHelp logo

esri / arcgis-maps-sdk-dotnet-samples Goto Github PK

View Code? Open in Web Editor NEW
403.0 59.0 516.0 416.99 MB

Sample code for ArcGIS Maps SDK for .NET – WPF, WinUI, .NET MAUI

License: Apache License 2.0

C# 95.22% CSS 1.85% Python 1.32% Dockerfile 0.02% Ruby 0.01% JavaScript 1.52% Shell 0.04% Batchfile 0.03%
wpf native-development samples csharp xaml arcgis arcgis-maps-sdk c-sharp dotnet esri

arcgis-maps-sdk-dotnet-samples's Introduction

Link: ArcGIS Developers home Link: Documentation Link: Tutorials Badge: Samples Link: Demos Link: Toolkit Link: Templates Link: NuGet Link: Esri Community

ArcGIS Maps SDK for .NET - Samples

Screenshot of the sample viewer for WPF


Interactive samples demonstrate the ArcGIS Maps SDK for .NET API

Get started

If you're on Windows, the easiest way to get started is to download the viewer from the Microsoft Store:

Get it from Microsoft badge

Or, you can browse a searchable list of samples on the ArcGIS for developers website:

Link: WPF Link: WinUI Link: UWP Link: .NET MAUI

Build the samples locally

If you want to modify or debug sample code, you can clone this repo and load one of the following solutions:

  • All: src\ArcGIS.Viewers.All.sln
  • .NET MAUI (iOS, Android): src\MAUI\ArcGIS.Samples.Maui.sln

If you are only interested in one platform, you can open a platform-specific solutions:

  • WPF .NET: src\WPF\WPF.Viewer.Net.sln
  • .NET MAUI: src\MAUI\ArcGIS.Samples.Maui.sln
  • WinUI: src\WinUI\ArcGIS.WinUI.Viewer.sln

When the ArcGIS.Viewers.All.sln and WPF.Viewer.Net.sln are opened in Visual Studio, you can change the framework to .NET Framework from the debug button dropdown menu.

The following platforms are being kept for reference, but no new sample implementations are being added:

  • UWP: src\Windows\ArcGIS.UWP.Viewer.sln

Notes

IMPORTANT When you run the samples, you will need to provide an API key. You can get a free developer account and key on the ArcGIS Developers website. For more information see https://links.esri.com/arcgis-runtime-security-auth.

  • The .NET sample viewers have a prompt for setting an API key. You can also hardcode your API key in the GetLocalKey() method of the ApiKeyManager class.
  • Before using WinUI, install the latest Windows SDK and the vsix plugin.
  • When compiling Universal Windows Platform or WinUI samples, make sure that you are compiling against x86/x64/ARM platform and not using AnyCPU.

Offline data

Several samples require local data to function properly. That data is downloaded to local storage automatically when a sample is run. This process is handled by the DataManager class (located in the 'Managers' folder in each viewer project). Samples that use the data manager to download their data are differentiated as follows:

  • They have RequiresOfflineData set to true in their metadata.json files
  • They have one or more entries under DataItemIds in their metadata.json files (these are portal item Ids)
  • They use the data manager to identify the correct path for their offline files at run time

See the contribution guidelines for more detailed information.

Requirements

Supported system configurations for ArcGIS Maps SDK for .NET

Tools

Esri uses several tools to more efficiently manage the content in this repo. See Tools for more information.

Contribute

Anyone and everyone is welcome to contribute.

License

Copyright 2022 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

https://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.

A copy of the license is available in the repository's license.txt file.

arcgis-maps-sdk-dotnet-samples's People

Contributors

andy-weis avatar anttikajanus avatar arcgis-maps-sdk-bot avatar asantana917 avatar asserswelam avatar cgutierrez-gis avatar chrisahill avatar dbroux avatar dependabot[bot] avatar dkemlage avatar dotmorten avatar duffh avatar gdestigter avatar jnery avatar katydalton avatar mbranscomb avatar mstefarov avatar ncastle1 avatar pmaske avatar prathameshnarkhede avatar rexhansen avatar semcilreavy avatar tejabalu avatar thadt avatar timbojoe avatar tsamaya avatar twakim avatar williambohrmann3 avatar zackallen avatar zwaap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcgis-maps-sdk-dotnet-samples's Issues

Sample issue: DynamicLayerEditGeometry error when apply edits

Sample issue: DynamicLayerEditGeometry error when apply edits

When click Complete to Apply Edits back to the server we get error
Error Code "500": 'Unable to complete operation.' Unable to perform applyEdits operation.'

The other samples use the applyEdits operation without issues so I suspect it is a problem with the Wildfire service that is used in this sample.
http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/MapServer

WPF: AuthenticationManager does not remember CertificateCredential

When using a challenge handler to let the user choose a client certificate (for accessing a PKI-secured portal, e.g.), AuthenticationManager may prompt the user to choose the same certificate several times. While the certificate credential appears to be stored correctly, AuthenticationManager may not corrrectly recognize an existing credential and therefore might challenge for it again.

A potential workaround is to pull the existing credential from the credentials collection and return it from the challenge handler method. If the app will be handling a variety of credentials (for various servers, e.g.), you will need additional logic to check the service URI.

credential = AuthenticationManager.Current.Credentials.FirstOrDefault();

if (credential != null)
{
    if (credential.ServiceUri.AbsoluteUri.StartsWith(SecuredPortalUrl))
    {
        // Return the CertificateCredential for the secured portal
        return credential;
    }
}

// ... challenge for the credential by prompting the user to choose a client certificate ...

How are relationships implemented in Quartz for .NET?

Hi!

How are relationships supported in Quartz (beta) for .NET for online FeatureServices/ ArcGISMapImageLayer and offline geodatabases ?

How can I generally acquire information about relationship defintions from offline geodatabase tables and feature services ?
I cannot find anything that corresponds to the implementation in
ArcGIS Runtime for .NET 10.2.7 (see images below), neither in the API, nor in the supplied ArcGISFeatureLayerInfo (ServiceInfo)

Thank you in advance.

ArcGIS Runtime for .NET 10.2.7:
relationshipclassruntimedotnet1027
queryrelationshipruntimedotnet1027

New sample: Author (and save) a map

Allow the user to make changes to the current map (basemap, operational layers, extent) then save it as a web map to their portal. The sample will require additional code to handle logging the user in to their portal (ArcGIS Online) using OAuth.
The user can continue to make changes and save them to the existing portal item, or clear the map and create a new map to save.

  • WPF (C#)
  • WPF (VB)
  • UWP (C#)
  • UWP (VB)

Method Name Expected: authorizeOnUIAction = new Action((() ... O_o

On Win 7 x64 in VS13, I opened, restored NuGet packs, and cleaned the solution. However, build yielded the following error.

Error 4 Method name expected ~\arcgis-runtime-samples-dotnet-master\src\WPF\ArcGISRuntime.WPF.Samples\Samples\Map\AuthorMap\AuthorMap.xaml.cs
435 54 ArcGISRuntime.WPF.Samples.CSharp

AuthorMap.xaml.cs lines 429-437:

            var dispatcher = Application.Current.Dispatcher;
            if (dispatcher == null || dispatcher.CheckAccess())
                AuthorizeOnUIThread(_authorizeUrl);
            else
            {
                var authorizeOnUIAction = new Action((() => AuthorizeOnUIThread(_authorizeUrl)));
                dispatcher.BeginInvoke(authorizeOnUIAction);
            }

Suggestions?

Thanks for considering,

Matthew

Update samples with geometry enhancements for v.next

Update samples to use geometry builders and/or constructors instead of creating new instances of geometry objects then explicitly setting geometry property. Note do not use constructors if the geometry may be invalid - use Builder instead.

SetSpatialReference (UWP)

Add a map that sets the spatial reference. Layers that can be projected will draw in the new spatial reference, others will fail to display

[Phone] Add sample using WebAuthenticationBroker with OAuth

Add a sample that demonstrates how to use the recommended workflow for OAuth secured resources with Windows Phone 8.1 using WebAuthenticationBroker with IdentityManager in the ArcGIS Runtime SDK for .NET.

Microsoft is promoting the use of WebAuthenticationBroker with OAuth workflows. It's built into the ArcGIS Runtime SDK for .NET - Windows Store API. It is not in the Windows Phone API due to complexity of implementation. For sake of completeness we should include a sample. Note, the current OAuth samples show use of web views.

The WebAuthenticationBroker is limited by one issue, the domain in the authorize and approval urls must match. If during the OAuth login process a user chooses to change the url (eg enter an organization subdomain) the WebAuthenticationBroker will not work. The solution is either 1) use app logic to determine the organization url before the OAuth workflow starts or 2) Use a web view.

For discussion and background details see: http://blogs.msdn.com/b/thunbrynt/archive/2014/04/14/windows-phone-8-1-for-developers-web-authentication-broker.aspx

Error using Security sample OAuth

I'm trying to use the OAuth Authentication sample but it doesn't work on android.
The UWP works fine, but Android raised an error : Error 400 Invalid request.
The login UI appears, and the user can specify login and password. But clicking the connect button raises this error.

Trying to debug it, I used fiddler to trace network traffic between emulator and server.
It appears that the oauthorize request parameters contain "response_type=token" instead of "response_type=code" as mentionned in the doc (https://developers.arcgis.com/authentication/mobile-and-native-user-logins/#authorization-example)
Is it normal?

Add editing samples

  • dev @jnery
    • FeatureLayerEditGeometry
    • FeatureLayerEditAttribute
    • EditAttachment
    • EditRelatedData
    • ExplicitSave
    • OwnershipBasedEditing
    • DynamicLayerEditAttribute
    • DynamicLayerGeometryAttribute

Rotate map (UWP)

Add map with slider that rotates the MapView.

  • [x ] VB
  • [x ] C#

MessageProcessingSample: need to document that installed SDK is required

Problem

MessageProcessingSample is designed to display military symbols on the map, using MIL-STD-2525C. But an error message displays when Process messages is clicked:

The Message could not be processed. MessageLayer must have been successfully loaded into a View (Map or Scene) before calling ProcessMessage.

Instead, the messages should display.

Cause

This sample requires the installed ArcGIS Runtime SDK for .NET. There are directions to reference the installed SDK, but I can't find documentation in this repository that states which samples require the installed SDK. The key step is to delete the arcgisruntime10.2.x directory in output\Desktop\Debug.

Possible Resolution

Please add documentation somewhere to indicate the need for MessageProcessingSample to use the installed SDK.

DirectionsLanguage in german are not working

DirectionsLanguage in German are not working , throws exception ...
routeParams.DirectionsLanguage = new CultureInfo("de");

working for English ..
routeParams.DirectionsLanguage = new CultureInfo("de");

using mvvm with isvisible for wmslayer and layers

i have a viewmodel with a boolean value to switch off/on layers (ShowFietsknooppunten)
in xaml i declare the binding but i tried a lot of opties but it doesn't work

IsVisible="{Binding DataContext.ShowFietsknooppunten, ElementName=mainscreen}"

mainscreen is the name of the usercontrol on which the mapview resides. This usercontrol datacontext is set to the viewmodel.

File "SampleDescriptions.xml" not found

In the Project "ArcGISRuntime.Samples.Desktop", the resource "Assets\SampleDescriptions.xml" is not found, and the main Project "ArcGISRuntime.Samples.DesktopViewer" uses the file to classify by category.

Change viewpoint (Desktop)

Change viewpoint

This sample should demonstrate how the current viewpoint can be changed. The Sample will open with a default service viewpoint. Each subsequent button click will change the viewpoint using different methods (one to a provided extent, another a point and scale, and another to rotate the viewpoint by 90 degrees

Add security samples - Tokens

Update the 10.2.7 ArcGIS Token security samples for Quartz (known user and challenge).

  • WPF (CS)
  • WPF (VB)
  • UWP (CS)
  • UWP (VB)

Add Security Samples - PKI

Update the 10.2.7 PKI security sample for Quartz.

  • WPF (CS) PR #233 ready for review
  • WPF (VB) PR #233 ready for review
  • UWP (CS) PR #231 ready for review
  • UWP (VB) PR #231 ready for review

NullReferenceException on custom IOAuthAuthorizeHandler sample

It seems that the current custom IOAuthAuthorizeHandler sample fails with NullReferenceException if its authentication process is called from UI thread. The following is where the exception occurs:

_tcs = new TaskCompletionSource<IDictionary<string, string>>();

// Call a function to show the login controls, make sure it runs on the UI thread for this app
var dispatcher = Application.Current.Dispatcher;
if (dispatcher == null || dispatcher.CheckAccess())
    AuthorizeOnUIThread(_authorizeUrl);
else
{
    var authorizeOnUIAction = new Action((() => AuthorizeOnUIThread(_authorizeUrl)));
    dispatcher.BeginInvoke(authorizeOnUIAction);
}

// Return the task associated with the TaskCompletionSource
return _tcs.Task;

If AuthorizeOnUIThread is called without dispatcher.BeginInvoke, "return _tcs.Task" is called after all authentication process is completed. Since _tcs becomes null at the completion of authentication, "return _tcs.Task" throw NullReferenceException.

I'm simply setting the IOAuthAuthorizeHandler sample to AuthenticationManager.Current.OAuthAuthorizeHandler. Is there any specific way to avoid this exception?

*I believe that the following is custom IOAuthAuthorizeHandler sample from version 10.2.7 which does not have this issue.

// Create a task completion source
_tcs = new TaskCompletionSource<IDictionary<string, string>>();
var tcs = _tcs;

// Call a function to show the login controls, make sure it runs on the UI thread for this app
var dispatcher = Application.Current.Dispatcher;
if (dispatcher == null || dispatcher.CheckAccess())
    AuthorizeOnUIThread(_authorizeUrl);
else
{
    var authorizeOnUIAction = new Action((() => AuthorizeOnUIThread(_authorizeUrl)));
    dispatcher.BeginInvoke(authorizeOnUIAction);
}

// Return the task associated with the TaskCompletionSource
return tcs.Task;

Failed to load local raster

I am trying to load a tif file using below code.

    var myRaster_left = new Raster(@"C:\2015\11.tif");
    RasterLayer newRasterLayer_left = new Esri.ArcGISRuntime.Mapping.RasterLayer(myRaster_left);
     MyMapViewLeft.Map.OperationalLayers.Add(newRasterLayer_left);// adding raster

I get the error "An exception of type 'System.NullReferenceException' occurred in MilitaryApp.exe but was not handled in user code"

The file and path are absolutely fine and I am able to view in ArcGIS Desktop.However, runtime is unable to load the raster.Debugging shows variable myRaster_left is set to null.

ArcGISRuntime.WPF.Viewer Missing ~\WPF\debug\ArcGISRuntime.WPF.Samples.dll

On Win 7 x64 in VS13, initial build yielded the following error.

Error 2 Metadata file '~\arcgis-runtime-samples-dotnet-master\output\WPF\debug\ArcGISRuntime.WPF.Samples.dll' could not be found
ArcGISRuntime.WPF.Viewer

Is this file sold separately, or should I rename an assembly reference?

Curiously,

Matthew

"sample-data" should be "samples-data".

In the section for Instructions of the README.md file, there is a little spelling mistake. Here is the sentence:

Place sample data contents in a folder named "sample-data" at the same level as the "src" folder for this repo.

If you make a folder named sample-data the project will never work, should be samples-data.

Problem with TestFlight validation

I am trying to use ArcGIS runtime nuget package in Xamarin iOS app. Once i add the NuGet package, build the app and publish it to TestFlight, I get the following errors. Does anyone have experience with this issue ?

ERROR ITMS-90086: "Missing 64-bit support. iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK or later. We recommend using the default "Standard Architectures" build setting for "Architectures" in Xcode, to build a single binary with both 32-bit and 64-bit support."

ERROR ITMS-90668: "Invalid Bundle Executable. The executable file '/Frameworks/ArcGIS-arm64.framework/ArcGIS-arm64' contains incomplete bitcode. To compile binaries with complete bitcode, open Xcode and choose Archive in the Product menu."

ERROR ITMS-90668: "Invalid Bundle Executable. The executable file '/Frameworks/ArcGIS-armv7.framework/ArcGIS-armv7' contains incomplete bitcode. To compile binaries with complete bitcode, open Xcode and choose Archive in the Product menu."

ERROR ITMS-90203: "Invalid architecture: Apps that include an app extension and framework must support arm64."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.