This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AGSGeometry { | |
static func decodeCompressedGeometry(_ compressedString: String, spatialReference sr: AGSSpatialReference) -> AGSPolyline? { | |
// Break the string up into signed parts. | |
// The first part is a coefficient. | |
// Subsequent pairs of parts make up the remaining coordinates, encoded. | |
let pattern = #"((\+|\-)[^\+\-]+)"# | |
guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else { | |
return nil | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func downloadPreplannedOfflineMap() async throws { | |
guard let area = (try await task.getPreplannedMapAreas()).first else { return } | |
let params = try await task.defaultDownloadPreplannedOfflineMapParameters(with: area) | |
let job = task.downloadPreplannedOfflineMapJob( | |
with: params, | |
downloadDirectory: docsURL.appendingPathComponent(Date().ISO8601Format(), isDirectory: true) | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AGSTileInfo { | |
func calculateTiles(for geometry: AGSGeometry) -> [AGSTileKey: AGSEnvelope]? { | |
return calculateTiles(for: geometry.extent)?.filter({ item in | |
let env = item.value | |
return AGSGeometryEngine.geometry(geometry, intersects: env) | |
}) | |
} | |
// Get the tile extents for the greatest level of detail. This is good for downloading tiles for | |
// elevation queries, but might not be the desired tile count for a range of LODs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Bundle { | |
private static let agsBundle = AGSBundle() | |
/// An end-user printable string representation of the ArcGIS Bundle version shipped with the app. | |
/// | |
/// For example, "2883" | |
static var sdkBundleVersion: String { | |
return (agsBundle?.object(forInfoDictionaryKey: "CFBundleVersion") as? String) ?? "?" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum QueryError: LocalizedError { | |
case couldNotParseJSON | |
case unexpectedJSONResponse | |
} | |
func doQuery(layerURL: URL, mapPoint: AGSPoint, fields: [String] = ["*"], returnGeometry: Bool = true, completion: (([AGSGraphic]?, Error?) -> Void)? = nil) { | |
var mapPointData: Data? | |
do { | |
let mapPointJSON = try mapPoint.toJSON() | |
mapPointData = try JSONSerialization.data(withJSONObject: mapPointJSON) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import ArcGIS | |
//MARK: - Custom AGSLocationDataSource | |
/// A custom AGSLocationDataSource that uses the public ISS Location API to return | |
/// realtime ISS locations at 5 second intervals. | |
class ISSLocationDataSource: AGSLocationDataSource { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// TestDrag | |
// | |
// Created by Nicholas Furness on 11/10/17. | |
// Copyright © 2017 Esri. All rights reserved. | |
// | |
import ArcGIS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> | |
<title>Load a basic web scene - 4.3</title> | |
<link rel="stylesheet" href="https://js.arcgis.com/4.3/esri/css/main.css"> | |
<script src="https://js.arcgis.com/4.3/"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (request) => { | |
let query = require('codec/query_string'); | |
// return if the block does not have anything to analyze | |
if (!query) { | |
return request.ok(); | |
} | |
// Require console to print debug information | |
let console = require('console'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AGSGraphicsOverlay { | |
fileprivate struct AssociatedKeys { | |
static var referenceNameKey = "geodev_referenceName" | |
} | |
var referenceName:String? { | |
get { | |
return objc_getAssociatedObject(self, &AssociatedKeys.referenceNameKey) as? String | |
} | |
set { |
NewerOlder