Class: LocalStorage

nyc/LocalStorage~ LocalStorage


new LocalStorage()

Class to provide access to localStorage and filesystem

Source:

Methods


<abstract> addToMap(map, features [, projcs])

Parameters:
Name Type Argument Description
map ol.Map | L.Map

The map on which to display the new layer

features string | Array.<Object>

The features from which to create the new layer

projcs string <optional>

The projection

Source:
Returns:

The new layer

Type
ol.layer.Vector | L.Layer

canDownload()

Check if download is available

Source:
Returns:
Type
boolean

getItem(key)

Get data from browser's localStorage if available

Parameters:
Name Type Description
key string

Storage key

Source:
Returns:
Type
string

loadGeoJsonFile(map, callback [, file])

Open a GeoJSON file from local disk

Parameters:
Name Type Argument Description
map ol.Map | L.Map

The map in which the data will be displayed

callback module:nyc/LocalStorage~LocalStorage#loadGeoJsonFileCallback

The callback function to receive the new layer

file File <optional>

File - if not provided the user will be prompted with a file dialog

Source:

loadShapeFile(map, callback [, files])

Open a shapefile from local disk

Parameters:
Name Type Argument Description
map ol.Map | L.Map

The map in which the data will be displayed

callback module:nyc/LocalStorage~LocalStorage#loadShapeFileCallback

The callback function to receive the new layer

files FileList <optional>

Files (.shp, .dbf, .prj) - if not provided the user will be prompted with a file dialog

Source:
See:

readTextFile(callback [, file])

Open a text file from local disk

Parameters:
Name Type Argument Description
callback module:nyc/LocalStorage~LocalStorage#readTextFileCallback

The callback function to receive file content

file File <optional>

File - if not provided the user will be prompted with a file dialog

Source:

removeItem(key)

Remove data from browser's localStorage if available

Parameters:
Name Type Description
key string

Storage key

Source:
Returns:
Type
string

saveGeoJson(name, data)

Save JSON data to a file prompting the user with a file dialog

Parameters:
Name Type Description
name string

File name

data string

JSON data to write to file

Source:

setItem(key, data)

Set data in browser's localStorage if available

Parameters:
Name Type Description
key string

Storage key

data string

Data to store

Source:

Type Definitions


loadGeoJsonFileCallback(layer)

Parameters:
Name Type Description
layer ol.layer.Vector | L.Layer

The layer created from the GeoJSON file

Source:

loadShapeFileCallback(layer)

Parameters:
Name Type Description
layer ol.layer.Vector | L.Layer

The layer created from the shapefile

Source:

readTextFileCallback(fileContents)

Parameters:
Name Type Description
fileContents string

The string contained in the file

Source: