Data Functions

The Map SDK provides a variety of data functions, allowing you to add, remove, and filter data from datasets on your Unfolded Maps.

For data operations such as uploading, copying, and deleting datasets on the Unfolded Cloud, utilize the Data SDK.


Add Dataset

This method can be used to add previously uploaded datasets to a map. Datasets can be either uploaded via the Unfolded Data SDK or manually added in Unfolded Cloud. Provide the dataset's UUID to add a dataset from the Unfolded Cloud.

unfoldedMap.addDataset('DATASET-UUID-GOES-HERE')
unfolded_map.add_dataset('DATASET-UUID-GOES-HERE')

Alternatively, if a Dataset object with data is provided, a new dataset will be created an added to the map. This dataset will not uploaded to the Unfolded Cloud. You can also use the centerMap parameter to center the viewport on the new dataset.

unfoldedMap.addDataset({
  uuid: 'DATASET-UUID-GOES-HERE',  // use e.g. www.uuidgenerator.net
  label: 'Cities',
  data: JSON.stringify([
    {city: 'Buenos Aires', country: 'Argentina', lat: -34.58, lon: -58.66},
    {city: 'Brasilia', country: 'Brazil', lat: -15.78, lon: -47.91},
    {city: 'Santiago', country: 'Chile', lat: -33.45, lon: -70.66},
    {city: 'Bogota', country: 'Colombia', lat: 4.60, lon: -74.08},
    {city: 'Caracas', country: 'Venezuela', lat: 10.48, lon:-66.86}
  ])
  centerMap = true
})
import pandas as pd
unfolded_map.add_dataset({
  'label': 'Cities',
  'data': pd.DataFrame({
    'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas'],
    'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela'],
    'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48],
    'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86]
    })
})

addDataset reference


Remove Dataset

Remove a dataset from the map. Pass the UUID of the dataset to remove. This does not delete your dataset or any data associated with it.

const unfoldedMap = new UnfoldedMap({
  mapUUID: 'MAP-UUID-GOES-HERE',
  embed: true,
  appendToDocument: true
});
unfoldedMap.removeDataset('DATASET-UUID-GOES-HERE')
unfolded_map.remove_dataset('DATASET-UUID-GOES-HERE')

removeDataset reference


Refresh Map Data

Reloads the data displayed on the map. If your dataset receives frequent updates, this feature is particularly useful.

🚧

Note:

In development. Only works with published maps.

const unfoldedMap = new UnfoldedMap({
  mapUUID: 'MAP-UUID-GOES-HERE',
  embed: true,
  appendToDocument: true
});
unfoldedMap.refreshMapData();
unfolded_map.refresh_map_data()

refreshMapData reference


Set Filter

Sets a filter value for a field on a dataset.

The follow example applies a range filter on the magnitude field between values 15 and 20.

const unfoldedMap = new UnfoldedMap({
  mapUUID: 'MAP-UUID-GOES-HERE'
});
unfoldedMap.setFilter({
  id: 'value-filter',
  field: 'magnitude',
  value: [15, 20]
});
from unfolded.map_sdk import UnfoldedMap
unfolded_map = UnfoldedMap(mapUUID='MAP-UUID-GOES-HERE')
unfolded_map.set_filter({
  'id': 'value-filter',
  'field': 'magnitude',
  'value': [15, 20]
})

setFilter reference


Did this page help you?