Giter Club home page Giter Club logo

mapbook-ios's Introduction

Mapbook iOS

This repo is home to the mobile mapbook app, an example application using the ArcGIS Runtime SDK for iOS. Replace the paper maps you use for field work with offline maps.


Features

  • Mobile map packages
  • Feature layers
  • Identify
  • Table of Contents
  • Show a legend
  • Use a map view callout
  • Geocode addresses
  • Suggestion search
  • Bookmarks
  • Sign in to your portal

Best Practices

The project also demonstrates some patterns for building real-world apps around the ArcGIS Runtime SDK.

  • Defining a modular, decoupled UI that operates alongside a map view
  • Asynchronous service and UI coding patterns
  • Internal application communication patterns
  • FileManager used with ArcGIS

Detailed Documentation

Read the docs for a detailed explanation of the application, including its architecture and how it leverages the ArcGIS platform, as well as how you can begin using the app right away.

Get Started

Make sure you've installed Xcode and the ArcGIS Runtime SDK for iOS and that they meet these requirements.

Fork the repo

Fork the Mapbook App repo.

Clone the repo

Once you have forked the repo, you can make a clone.

Make sure to use the "recursive" option to ensure you get the ArcGIS Runtime Toolkit submodule

git clone --recursive [URL to forked Git repo]

If you've already cloned the repo without the submodule, you can load the submodule using

git submodule update --init

Command line Git

  1. Clone the Mapbook App
  2. cd into the mapbook-ios folder
  3. Make your changes and create a pull request

Configuring a Remote for a Fork

If you make changes in the fork and would like to sync those changes with the upstream repository, you must first configure the remote. This will be required when you have created local branches and would like to make a pull request to your upstream branch.

  1. In the Terminal (for Mac users) or command prompt (fow Windows and Linus users) type git remote -v to list the current configured remote repo for your fork.
  2. git remote add upstream https://github.com/Esri/mapbook-ios.git to specify new remote upstream repository that will be synced with the fork. You can type git remote -v to verify the new upstream.

If there are changes made in the original repository, you can sync the fork to keep it updated with upstream repository.

  1. In the terminal, change the current working directory to your local project
  2. Type git fetch upstream to fetch the commits from the upstream repository
  3. git checkout master to checkout your fork's local master branch.
  4. git merge upstream/master to sync your local master branch with upstream/master. Note: Your local changes will be retained and your fork's master branch will be in sync with the upstream repository.

Configure the app

Before running the app, it must be configured with application credentials. Follow the steps below to obtain application credentials used for browsing and downloading Portal content.

  1. Register an ArcGIS Portal Application.
  2. Configure the Mapbook App project to reference that application.
  3. License the app to remove the Developer Mode watermark.

1. Register an Application

For OAuth configuration, create a new Application in your ArcGIS Portal to obtain a Client ID and configure a Redirect URL. The Client ID configures the ArcGIS Runtime to show your users, during the log in process, that the application was built by you and can be trusted. The Redirect URL configures the OAuth process to then return to your app once authentication is complete.

  1. Log in to https://developers.arcgis.com with either your ArcGIS Organizational Account or an ArcGIS Developer Account.
  2. Visit your dashboard and create a new application.
  3. In the Authentication tab, note the Client ID
  4. In the Authentication tab add a redirect URI to the Current Redirect URIs section. By default the Xcode project is configured to authentication callbacks using:

mapbook://auth

2. Configuring the project

Configure Redirect URL

  1. Open the project in Xcode and browse to the mapbook-iOS target's Info panel and expand the AGSConfiguration dictionary (see steps 1-4 in the screenshot below). Configure the App URL Scheme
  2. Set the AppURLScheme value to match the Redirect URL scheme configured in "Register an Application" above. The scheme is the app name that comes before :// in the redirect URI.

mapbook://auth

  1. Expand the URL Types section and modify the existing entry.
    • The Identifier doesn't matter, but should be unique.

    ex: com.esri.mapbook

    • The URL Scheme should match the Redirect URL scheme configured in "Register an Application" above. The scheme is the app name that comes before :// in the redirect URI.

    mapbook://auth

Configure the App URL Scheme

Configure Client ID

  1. In the Navigator pane under the project, find the file named AppSettings.swift.
  2. Within AppSettings.swift set the value of the static variable clientID to the application's Client ID noted in the step 'Register an Application'.

3. License the app (Optional)

This step is optional during development, but required for deployment.

  1. Access your dashboard and get your Runtime Lite license key.
  2. Open the project in Xcode and navigate to AppSettings.swift, the same file used to configure your applications client id.
  3. Set the value of the static variable licenseKey to the value from step 1.

Learn More

Learn more about the App Architecture and usage here.

Requirements

Note: Starting from the 100.8 release, the ArcGIS Runtime SDK for iOS uses Apple's Metal framework to display maps and scenes. However, Xcode does not support Metal based rendering in any version of iOS simulator on macOS Mojave. If you are developing map or scene based apps in these environments, you will need test and debug them on a physical device instead of the simulator.

Note: The 100.10 release of the ArcGIS Runtime SDK for iOS replaces the installed "fat framework" ArcGIS.framework with a new binary framework ArcGIS.xcframework. It also changes the location of the installed framework file and removes the need for the strip-frameworks.sh Build Phase. These changes have been incorporated in the latest release of Mapbook iOS.

Contributing

Anyone and everyone is welcome to contribute. We do accept pull requests.

  1. Get involved
  2. Report issues
  3. Contribute code
  4. Improve documentation

MDTOC

Generation of this and other documents' table of contents in this repository was performed using the MDTOC package for Atom.

Licensing

Copyright 2017 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.

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

For information about licensing your deployed app, see License your app.

mapbook-ios's People

Contributors

doneill avatar esreli avatar mhdostal avatar mikewilburn avatar nixta avatar philium avatar sabaranski avatar saratchandrakarumuri avatar singhgag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

mapbook-ios's Issues

Offline mode username display

If the app is offline in Portal mode, tapping on the User button shows the words "username" and "fullname" in the popup. This should probably not show anything, if showing the actual user is not possible.

TOC content is reversed

Per the review meeting today, the TOC content should show the point layers at the top and the basemap at the bottom.

Switching to Portal mode while offline

If I try to switch to Portal mode while device is offline, the following happens:

  • I'm asked to confirm I want to switch
  • I get the message to hit the + to download maps
  • Once I hit the + I get the popup to specify the URL
  • When I hit continue, nothing happens. No error, no crash, nothing

What I think should happen:

  • When I try to switch to Portal mode while offline, I should get a message letting me know that I need to be online in order to use Portal mode.

@zinfin @mikewilburn thoughts?

HTML tags are displayed in Description labels

HTML is not parsed properly and the tags are displayed in the description labels.

  • When there is only one map in the package, the HTML tags are displayed in the offline maps list.

  • When a package has multiple maps, then the the description is the tableView is rendered fine but the description of the individual maps has the tags.

img_0069
img_0070
img_0071

Change repo topics

To be consistent with other Esri repo topics categorization, please remove topics ios-swift and ios-app, add topics native-development, ios, and swift

Search view controller

  • Provide suggestions for input
  • Geocode based on selected suggestion
  • Show results on map view

Handle expiration of mobile map packages

100.5 Runtime added ability to handle expiration of mobile map packages -

Time-based expiration of mobile map packages and mobile scene packages is now supported in ArcGIS Runtime. An author can choose either a hard expiration where the package is not usable after the expiry date, or a soft expiration where a warning message my be displayed to the user but the package is still usable after the expiry date. Packages with such expiration constraints can be created using an upcoming version of ArcGIS Pro.

See https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_mobile_map_package.html#a39fca5954cf2d4176c82322ff51726d9

Update the default portal url string to omit the 'www'

Logging into the generic https://www.arcgis.com portal works just fine.
However, modifying the string to be that of a specific portal, say https://www.runtime.maps.arcgis.com, will throw an error:

An SSL error has occurred and a secure connection to the server cannot be made.

This is because the 'www' ought to be omitted in this case --> https://runtime.maps.arcgis.com should be used instead.
To encourage this, and to prevent users from running into this error, I suggest we remove the www from the default string altogether.

Write documentation

Spin up a wiki that documents the application from a developer pattern and data perspective that can eventually be duplicated to the developers.arcgis.com/example-apps/mapbook-ios site.

Background download

MMPKs should be downloading in the background. As a best practice, the user should not be tied to the app as the data is being downloaded, especially since some of the MMPKs are quite large and will take a while to download.

Size is missing for offline maps

For downloaded maps, size attribute is not displayed. Size needs to be displayed in two locations

  • In the tableView in the list of maps
  • In the view that displays the details of the map

Popup doesn't resize

The popup window should resize based on content. If the identified feature only has 2 attributes, most of the popup box is blank

Option to cancel a map download

At present, when a map download is initiated by accident, there is no option to cancel the download unless the user logs off and delete all local data. A button can be added to cancel the ongoing download.

Add legend

Capabilities:

  • List operational layers
  • Change visibility of each layer
  • Legend for each layer

Search button doesn't trigger search

When searching for a feature, tapping the Search button doesn't trigger a search. Only tapping on one of the suggestions actually triggers the search. It should do both, in case user's locator doesn't support autosuggest

App crashes when switching to Portal mode

When I switch to Portal mode, on the "Specify the URL..." popup, when I hit Continue, the app crashes. Below is the error from XCode. The url is the default one: https://www.arcgis.com

2017-08-25 09:33:00.714 mapbook-iOS[564:138335] <CATransformLayer: 0x1464dff0> - changing property contentsGravity in transform-only layer, will have no effect
2017-08-25 09:33:12.249 mapbook-iOS[564:138335] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported'
*** First throw call stack:
(0x2383791b 0x22fd2e17 0x23837861 0x2e63386f 0x37363f 0x372c91 0x444093 0x12538b7f 0x12538b6b 0x1253d655 0x237f9b6d 0x237f8067 0x23747229 0x23747015 0x24d37ac9 0x27e1b189 0xee960 0x233ef873)
libc++abi.dylib: terminating with uncaught exception of type NSException```

Error on loading map packages

Sometimes while opening downloaded maps, following error is displayed. This error is totally random and when opened again the same package opens as expected.

img_0067
img_0068

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.