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:
True if download is available
- Type
- boolean
-
<protected> customProj(projcs, proj4)
-
Add a new projection to proj4 and return the code
Parameters:
Name Type Description projcs
string The projecion as defined in a prj file
proj4
Object The proj4 instance
- Source:
Returns:
The code for the new projection
- Type
- string | undefined
-
getItem(key)
-
Get data from browser's localStorage if available
Parameters:
Name Type Description key
string Storage key
- Source:
Returns:
The value of the key in local storage
- Type
- string
-
loadGeoJsonFile(map, callback [, file])
-
Open a GeoJSON file from filesystem
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 filesystem
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 filesystem
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:
-
saveGeoJson(name, data)
-
Save GeoJSON 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)
-
Callback for module:nyc/LocalStorage~LocalStorage#loadGeoJsonFile
Parameters:
Name Type Description layer
ol.layer.Vector | L.Layer The layer created from the GeoJSON file
- Source:
-
loadShapeFileCallback(layer)
-
Callback for module:nyc/LocalStorage~LocalStorage#loadShapeFile
Parameters:
Name Type Description layer
ol.layer.Vector | L.Layer The layer created from the shapefile
- Source:
-
readTextFileCallback(fileContents)
-
Callback for module:nyc/LocalStorage~LocalStorage#readTextFile
Parameters:
Name Type Description fileContents
string The text contained in the file
- Source: