Documentation for MapLib/Api.swift

class API

A class with common api methods

func version(component: String) Int

Returns library version as number

Parameters
  • component – May be self, gdal, sqlite, tiff, jpeg, png, jsonc, proj, geotiff, expat, iconv, zlib, openssl

Returns

version number

func versionString(component: String) String

Returns library version as string

Parameters
  • component – May be self, gdal, sqlite, tiff, jpeg, png, jsonc, proj, geotiff, expat, iconv, zlib, openssl

Returns

version string

func freeResources(full: Bool)

Free library resources. On this call catalog removes all preloaded tree items. The map storage closes and removes all maps

Parameters
  • full – If true catalog and map storage will be freed, otherwise only map storage

func lastError() String

Returns last error message

Returns

message string

func getCatalog() Catalog

Get catalog class instance. The catalog object is singleton.

Returns

Catalog class instance

func getMap(_ name:String) Map?

Get map by name

Parameters
  • name – map file name. If map file name extension is not set it will append.

Returns

Map class instance or nil

func getStore(_ name:String) Store?

Get NextGIS store catalog object. The NextGIS store is geopackage file with some addtions needed for library.

Parameters
  • name – File name. If file name extension is not set it will append.

Returns

Catalog object instance or nil

func getDataDirectory() Object?

Get library data directory. Directory to store various data include maps, files, etc.

Returns

Catalog object instance or nil

func getTmpDirectory() Object?

Get library temp directory.

Returns

Catalog object instance or nil

func getDocDirectory() Object?

Get library documents directory

Returns

Catalog object instance or nil

func md5(string: String) String

Create MD5 hash from text

Parameters
  • string – text to create MD5 hash

Returns

MD5 hash string created from text

func getProperty(for key:String, withDefault value:String) String

Get library property

Parameters
  • key – key value

  • value – default value if not exists

Returns

property value correspondent to key

func setProperty(for key:String, with value:String)

Set library property

Parameters
  • key – key value

  • value – value to set