new LocalStorage()
Class to provide access to localStorage and filesystem
- Source:
Methods
-
<abstract> addToMap(map, features [, projcs])
-
Parameters:
Name Type Argument Description mapol.Map | L.Map The map on which to display the new layer
featuresstring | Array.<Object> The features from which to create the new layer
projcsstring <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 projcsstring The projecion as defined in a prj file
proj4Object 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 keystring 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 mapol.Map | L.Map The map in which the data will be displayed
callbackmodule:nyc/LocalStorage~LocalStorage#loadGeoJsonFileCallback The callback function to receive the new layer
fileFile <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 mapol.Map | L.Map The map in which the data will be displayed
callbackmodule:nyc/LocalStorage~LocalStorage#loadShapeFileCallback The callback function to receive the new layer
filesFileList <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 callbackmodule:nyc/LocalStorage~LocalStorage#readTextFileCallback The callback function to receive file content
fileFile <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 keystring Storage key
- Source:
-
saveGeoJson(name, data)
-
Save GeoJSON data to a file prompting the user with a file dialog
Parameters:
Name Type Description namestring File name
datastring JSON data to write to file
- Source:
-
setItem(key, data)
-
Set data in browser's localStorage if available
Parameters:
Name Type Description keystring Storage key
datastring Data to store
- Source:
Type Definitions
-
loadGeoJsonFileCallback(layer)
-
Callback for module:nyc/LocalStorage~LocalStorage#loadGeoJsonFile
Parameters:
Name Type Description layerol.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 layerol.layer.Vector | L.Layer The layer created from the shapefile
- Source:
-
readTextFileCallback(fileContents)
-
Callback for module:nyc/LocalStorage~LocalStorage#readTextFile
Parameters:
Name Type Description fileContentsstring The text contained in the file
- Source: