Documentation for MapLib/Store.swift

class MemoryStore : Object

In memory spatial data storage. After class instance destruction all data will be loose.

static let ext = ".ngmem"

Memory storage description file extension.

func createFeatureClass()

Create feature class in storage.

Параметры:
  • name – Feature class name.
  • geometryType – Geometry type.
  • epsg – Spatial reference EPSG code.
  • fields – Feature class fields.
  • options – Any other create option if form of key-value dictionary.
Результат:

FeatureClass class instance or nil.

class Store : Object

Spatial data storage. This is geopackage file with specific additions.

static let ext = ".ngst"

Spatial data storage file extension.

func createFeatureClass()

Create feature class in storage.

Параметры:
  • name – Feature class name.
  • geometryType – Geometry type.
  • fields – Feature class fields.
  • options – Any other create option if form of key-value dictionary.
Результат:

FeatureClass class instance or nil.

func createTable()

Create table in storage.

Параметры:
  • name – Table name.
  • fields – Table fields.
  • options – Any other create option if form of key-value dictionary.
Результат:

Table class instance or nil.

enum EditOperationType

Edit operation type. This is enumerator of edit operation types.

  • NOP: No operation.
  • CREATE_FEATURE: Create feature/row.
  • CHANGE_FEATURE: Change feature/row.
  • DELETE_FEATURE: Delete feature/row.
  • DELETE_ALL_FEATURES: Delete all features.
  • CREATE_ATTACHMENT: Create new attachment
  • CHANGE_ATTACHMENT: Change attachment name and/or description
  • DELETE_ATTACHMENT: Delete attachment
  • DELETE_ALL_ATTACHMENTS: Delete all attachmetns
struct EditOperation

Edit operation for logging properties.

class Raster : Object

Spatial referenced raster or image

func cacheArea()

Cache tiles for some area for TMS datasource.

Параметры:
  • bbox – Area to cache.
  • zoomLevels – Zoom levels to cache.
  • callback – Callback function which executes periodically indicating progress.
Результат:

True on success.

class Table : Object

Non spatial table.

var fields : [Field] = []

Fields array

var batchMode : Bool

Enable/disable batch mode property. The sqlite journal will be swith on/off.

var count : Int64

Feature/row count readonly property.

func createFeature()Feature?

Create new feature/row in memory.

Результат:New feature class instane or nil.
func insertFeature(_ feature:Feature, logEdits: Bool = true)Bool

Insert feature into table.

Параметры:
  • feature – Feature/row to insert.
  • logEdits – Log edits in history table. This log can be received using editOperations function.
Результат:

True on success.

func updateFeature(_ feature:Feature, logEdits: Bool = true)Bool

Update feature/row.

Параметры:
  • feature – Feature/row to update.
  • logEdits – Log edits in history table. This log can be received using editOperations function.
Результат:

True on success.

func deleteFeature(id: Int64, logEdits: Bool = true)Bool

Delete feature/row.

Параметры:
  • id – Feature/row identificator.
  • logEdits – Log edits in history table. This log can be received using editOperations function.
Результат:

True on success.

func deleteFeature(feature: Feature, logEdits: Bool = true)Bool

Delete feature/row.

Параметры:
  • feature – Feature/row to delete.
  • logEdits – Log edits in history table. This log can be received using editOperations function.
Результат:

True on success.

func deleteFeatures(logEdits: Bool = true)Bool

Delete all features/rows in table.

Параметры:
  • logEdits – Log edits in history table. This log can be received using editOperations function.
Результат:

True on success.

func reset()

Reset reading features/rows.

func nextFeature()Feature?

Get next feature/row.

Результат:Feature class instance or nil.
func getFeature(index: Int64)Feature?

Get feature/row by identificator.

Параметры:
  • index – Feature/row
Результат:

Feature class instance or nil.

func getFeature(remoteId: Int64)Feature?

Get feature/row by remote identificator.

Параметры:
  • remoteId – remote identificator.
Результат:

Feature class instance or nil.

func fieldIndexAndType(by name:String) → (index: Int32, type: Field.FieldType)

Search field index and type by field name.

Параметры:
  • name – Field name.
Результат:

Tuple with index and type. If field not exists the index will be negative and field type will be UNKNOWN.Get e

func editOperations()[EditOperation]

Get edit operations log.

Результат:EditOperation class array. It may be empty.
func delete(editOperation: EditOperation)

Delete edit operation from log.

Параметры:
  • editOperation – EditOperation to delete.
class FeatureClass : Table

Spatial table.

let geometryType : Geometry.GeometryType

Geometry type of feature class.

func createOverviews()

Create vector overviews to speedup drawing. This is a synchronous method.

Параметры:
  • force – If true the previous overviews will be deleted.
  • zoomLevels – The list of zoom levels to generate.
  • callback – Callback function to show process and cancel creation if needed.
Результат:

True on success.

func clearFilters()Bool

Clear any filters set on feature class.

Результат:True on success.
func setSpatialFilter(envelope: Envelope)Bool

Set spatial filter.

Параметры:
  • envelope – Features intesect with envelope will be returned via nextFeature.
Результат:

True on success.

func setSpatialFilter(geometry: Geometry)Bool

Set spatial filter.

Параметры:
  • geometry – Features intesect with geometry will be returned via nextFeature.
Результат:

True on success.

func setAttributeFilter(query: String)Bool

Set attribute filter.

Параметры:
  • query – SQL WHERE clause.
Результат:

True on success.

func setFilters(geometry: Geometry, query: String)Bool

Set spatial and attribute filtes.

Параметры:
  • geometry – Features intesect with geometry will be returned via nextFeature.
  • query – SQL WHERE clause.
Результат:

True on success.

class Field

FeatureClass/Table filed class.

let name : String

Field name.

let alias : String

Field alias.

let type : FieldType

Field type.

let defaultValue : String

Field default value.

init(name: String, alias: String, type: FieldType, defaultValue: String = nil)

Init field with values.

Параметры:
  • name – Field name.
  • alias – Field alias.
  • type – Field type.
  • defaultValue – Default value or nil.
enum FieldType : Int32

Field type enum.

  • UNKNOWN: Unknown type.
  • INTEGER: Integer type.
  • REAL: Real type.
  • STRING: String type.
  • DATE: Date/time type.