maps.nyc.gov

Class: Local

nyc.storage.Local

new Local()

Class to provide access to localStorage and filesystem
Source:

Methods

(abstract) addToMap(map, features, projcs) → {Object}

Parameters:
Name Type Description
map ol.Map | L.Map
features string | Array.<Object>
projcs string
Source:
Returns:
Type
Object

canDownload() → {boolean}

Check if download is available
Source:
Returns:
Type
boolean

getItem(key) → {string}

Get data from localStorage if available
Parameters:
Name Type Description
key string Storage key
Source:
Returns:
Type
string

loadGeoJsonFile(map, callbackopt, fileopt)

Open a GeoJSON file from local disk
Parameters:
Name Type Attributes Description
map ol.Map | L.Map The map in which the data will be displayed
callback function <optional>
The callback function to receive the added ol.vector.Layer
file File <optional>
File
Source:

loadShapeFile(map, callbackopt, filesopt)

Open a shapefile from local disk
Parameters:
Name Type Attributes Description
map ol.Map | L.Map The map in which the data will be displayed
callback function <optional>
The callback function to receive the added ol.vector.Layer
files FileList <optional>
Files (.shp, .dbf, .prj)
Source:
See:

readTextFile(callback, fileopt)

Open a text file from local disk
Parameters:
Name Type Attributes Description
callback function The callback function to receive file content
file File <optional>
File
Source:

removeItem(key) → {string}

Remove data from localStorage if available
Parameters:
Name Type Description
key string Storage key
Source:
Returns:
Type
string

saveGeoJson(name, data)

Save 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 localStorage if available
Parameters:
Name Type Description
key string Storage key
data string Data to store
Source: