geoanalytics

auth

geoanalytics.auth(**kwargs)

Used to authorize GeoAnalytics Engine.

Parameters
  • username (str) – GeoAnalytics Engine account username.

  • password (str) – GeoAnalytics Engine account password.

  • license_file (str) – Path to the GeoAnalytics Engine license file.

  • api_key (str) – GeoAnalytics Engine account API key.

auth_info

geoanalytics.auth_info()

Returns the GeoAnalytics Engine authorization information for the authorized user.

Example: geoanalytics.auth_info()

Returns

DataFrame containing the authorization information.

Return type

pyspark.sql.dataframe.DataFrame

create_optimal_sr

geoanalytics.util.create_optimal_sr(extent, sr, property, custom_name=None)

Creates a spatial reference with a custom projected coordinate system optimal for the specified extent and intended purpose of your analysis.

Supported Properties:

  • EQUAL_AREA - Preserves the relative area of regions everywhere on earth. Shapes and distances will be distorted.

  • CONFORMAL - Preserves angles in small areas. Shapes, sizes, and distances will be distorted.

  • EQUIDISTANT_ONE_POINT - Preserves distances when measured through the center of the projection. Areas, shapes, and other distances will be distorted.

  • EQUIDISTANT_MERIDIANS - Preserves distances when measured along meridians. Area, shape, and other distances will be distorted.

  • COMPROMISE_WORLD - Does not preserve areas, shapes, or distances specifically, but creates a balance between these geometric properties. Compromise projections are only suggested for very large areas.

Parameters
  • extent (BoundingBox) – Extent of the area of analysis

  • sr – Geographic spatial reference used to create the custom projected coordinate system.

  • property (str) – A property that represents the purpose of the projection. Choose from EQUAL_AREA, CONFORMAL, EQUIDISTANT_ONE_POINT, EQUIDISTANT_MERIDIANS, COMPROMISE_WORLD.

  • custom_name (str, optional) – The name of the custom projected coordinate system. If unspecified, the name will be Custom_Projection.

Returns

A spatial reference object

Return type

SpatialReference

deauth

geoanalytics.deauth()

Used to deauthorize GeoAnalytics Engine.

describe_locator

geoanalytics.util.describe_locator(path: str)

Returns a dictionary with the properties of a locator, including allAvailableOutputFields, countryCodes, defaultOutputFields, inputFields, maxNumberOfCandidates, minCandidateScore, spatialReference, supportedRoles, supportsAddresses, supportsIntersections, supportsPOI, userDefinedOutputFields, and version.

Refer to the GeoAnalytics Engine guide for examples: Geocoding

Parameters

path (str) – The path to the locator data source

Returns

A dictionary containing the properties of the locator

Return type

dict

describe_network_dataset

geoanalytics.util.describe_network_dataset(path: str, extended=False)

Returns a dictionary with the properties of the network dataset, including name, path, spatialReference, defaultTravelMode, travelModeNames, and costAttributeNames. With extended set to True, additional properties will be returned, including travelModes, restrictions, restrictUsageParamNames, and maxLocatingDistanceMeters.

Refer to the GeoAnalytics Engine guide for examples: Network Analysis

Parameters
  • path (str) – The path to the network data source

  • extended (bool, optional) – If True, the extended version of the network dataset properties will be returned

Returns

A dictionary containing the properties of the network dataset

Return type

dict

enable_warnings

geoanalytics.enable_warnings()

Enables GeoAnalytics Engine warnings.

disable_warnings

geoanalytics.disable_warnings()

Disables GeoAnalytics Engine warnings.

list_transformations

geoanalytics.util.list_transformations(from_sr, to_sr, extent=None)

Returns a list of valid transformation methods. An extent can be used to narrow the list of valid transformation methods for a specific geographic area.

Parameters
  • from_sr (SpatialReference) – The starting geographic coordinate system.

  • to_sr (SpatialReference) – The final geographic coordinate system.

  • extent (BoundingBox, optional) – Only transformations that span the entire extent will be returned. The extent needs to be specified in coordinates from the from_sr.

Returns

A dataframe of valid transformation methods.

Return type

pyspark.sql.DataFrame

register_gis

geoanalytics.register_gis(name, url='https://arcgis.com', *, username=None, password=None, cert_file=None, cert_password=None, client_id=None, authorization_code=None)

Registers a GIS with the system. The GIS can be ArcGIS Online or ArcGIS Enterprise.

The name of the GIS can be supplied in place of credentials when accessing resources within the GIS (e.g. feature services).

Parameters
  • name (str) – a user-defined name that identifies the GIS.

  • url (str) – URL for the GIS (e.g. https://arcgis.com or https://enterprise.example.com/portal). The default is ArcGIS Online.

  • username (str) – username for the GIS.

  • password (str) – password for the GIS.

  • cert_file (str) – Path to certificate file.

  • cert_password (str) – Password for certificate.

  • client_id (str) – Client id used for registering an OAuth 2.0 protected GIS.

  • authorization_code (str) – Authorization code is required when client_id is provided. Generate an authorization code through the following URL (replace “<url>” and “<client_id>” with the url and client_id): <url>/sharing/oauth2/authorize?client_id=<client_id>&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob.

unregister_gis

geoanalytics.unregister_gis(name)

Unregisters a GIS from the system. The GIS can be ArcGIS Online or ArcGIS Enterprise.

Parameters

name (str) – the user-defined name of a GIS registered with the system.

usage

geoanalytics.usage(**kwargs)

Returns GeoAnalytics Engine usage information for the authorized user.

Valid time units for the span and period input parameters:

  • h, hour, hours

  • d, day, days

  • w, week, weeks

  • m, month, months

  • y, year, years

Example: geoanalytics.usage(span=”1m”, period=”2days”)

Parameters
  • span (str, optional) – The time range covered by the returned usage DataFrame.

  • period (str, optional) – The aggregation interval for each row in the returned usage DataFrame.

Returns

DataFrame containing the usage information.

Return type

pyspark.sql.dataframe.DataFrame

version

geoanalytics.version()

Returns the GeoAnalytics Engine version.

Returns

GeoAnalytics Engine version.

Return type

str