pub struct GeoJsonSourceDataHandle { /* private fields */ }Expand description
Owned handle for prepared GeoJSON source data.
Self::new parses one complete UTF-8 GeoJSON document and tiles or
clusters it into the index a GeoJSON source consumes, which is the
expensive part of a data update. It needs no runtime or map and runs on
any thread, so a host prepares data on a worker thread and installs it on
the map owner thread through
crate::MapHandle::add_geojson_source_data or
crate::MapHandle::set_geojson_source_data.
The options are baked into the prepared data and must match the options of every source the data is installed on. Installing borrows the handle, so one prepared value may be installed on any number of sources; dropping or closing it afterwards never invalidates a source, because sources keep their own reference.
Implementations§
Source§impl GeoJsonSourceDataHandle
impl GeoJsonSourceDataHandle
Sourcepub fn new(data: &[u8], options: Option<&GeoJsonSourceOptions>) -> Result<Self>
pub fn new(data: &[u8], options: Option<&GeoJsonSourceOptions>) -> Result<Self>
Prepares GeoJSON source data. options may be None for defaults.
When options enable clustering, the data must be a feature collection
whose every feature carries point geometry; anything else is rejected
with an invalid-argument error naming the constraint.