Select to view content in your preferred language

Quick Runtime Test App for Tile Packages?

2727
5
11-06-2015 04:45 AM
AdamRepsher
Frequent Contributor

Hello all,

I am producing tile packages that are being used in a vendor-created application that uses ArcGIS Runtime.  The process to place the tile package into this application is lengthy and cumbersome.  I need a way to view/test the tile package in a Runtime environment.  Is there a simple demo application built that I can use to accomplish this on a PC?  I am not a developer, but would be willing to take a couple of "gettting started" walk-through trainings if needed.  Looking for a point in the right direction.

Thank you,

--Adam

0 Kudos
5 Replies
FreddieGibson
Honored Contributor

Do you have access to Visual Studio or are you looking for a deployed application that would allow you to test this?

0 Kudos
AdamRepsher
Frequent Contributor

Freddie Gibson,

If I can use the Express version - I think it is now called Visual Studio Community - Yes, I can download that and install.  Again, I have no developer experience.  I would need a walk-thru for everything.  If there is a good tutorial that utilizes the Tile Package and can just view, pan and zoom - I bet I could piece it together.

0 Kudos
FreddieGibson
Honored Contributor

I believe that there is enough information on the Esri website for you to be able to quickly put a sample together. The hard part would be if you're not familiar with programming and have to also learn C# or VB.Net. If you install Visual Studio on your machine I don't mind writing up a quick application that you can use to load the packages.

0 Kudos
AdamRepsher
Frequent Contributor

Freddie,

You are incredibly gracious. I can have Visual Studio installed Monday morning and we can go from there.

I could go through some of the tutorials found there, but which SDK should I use?  Qt? .NET?  This sounds a bit like me starting out with FLEX a number of years ago. I was able to make some changes and compile.  Nothing too complex though. Never created anything from scratch.

I like your offer to write a quick application. I just don't want to add to your workload.

Adam

0 Kudos
FreddieGibson
Honored Contributor

Hi Adam,

I apologize for the delay. I'll attach the sample application to this message. As to which SDK you should use, it would depend on your business requirements with the Runtime SDK. I personally prefer .NET because I'm more proficient in it and typically work in Windows environments, but I also leverage Java, Android, and iOS when the project requires using one of those SDKs.

The sample I've written uses the Runtime for .NET SDK. For each runtime API there should a sample application included that would most likely have a sample that shows how to open a tile package. I would assume that if you're familiar with other languages you shouldn't have too much trouble rewriting this sample into those languages.

I've also included a copy of the logic I used below along with an image of the application. You'll see that the application contains a single button that you can use to load tile packages from disk.

2015-11-11_1705.png

using System.Windows.Forms;
using Esri.ArcGISRuntime.Controls;
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using Esri.ArcGISRuntime.Layers;


namespace LoadTilePackage
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }


        private async void LoadButton_OnClick(object sender, RoutedEventArgs e)
        {
            // Allow the user to browse to a tile package
            string tpkPath = BrowseFolderForFile("Please select a Tile Package", "Tile Package (*.tpk)|*.tpk");
            if (String.IsNullOrEmpty(tpkPath))
                return;


            // Create a map to hold the layer
            Map map = new Map();


            // Load the tile package
            ArcGISLocalTiledLayer layer = new ArcGISLocalTiledLayer(tpkPath);
            await layer.InitializeAsync();


            // Add the tpk to the map
            map.Layers.Add(layer);


            // Replace the MapView's map with the new map
            MyMapView.Map = map;
        }


        public string BrowseFolderForFile(string title, string extension)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                Filter = extension,
                Multiselect = false,
                ShowHelp = true,
                Title = title
            };


            if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return string.Empty;
            
            string fileName = openFileDialog.FileName;
            return fileName;
        }
    }
}
0 Kudos