Skip to content
Docs version
@hungpvq/vue-map@1.1.0@hungpvq/vue-map-core@1.1.0@hungpvq/vue-map-dataset@1.1.0@hungpvq/vue-map-draw@1.1.0@hungpvq/map-draw@1.1.0@hungpvq/react-map@1.1.0@hungpvq/react-map-core@1.1.0@hungpvq/react-map-dataset@1.1.0@hungpvq/react-map-draw@1.1.0

Quick Dataset Creation

One-call helpers that build a root dataset (source + list UI + layer).

For a full Map + LayerControl walkthrough with inline GeoJSON and no GIS worker, see Minimal starter.

typescript
import { createGeoJsonDataset } from '@hungpvq/map-dataset/geojson';
import { createRasterUrlDataset } from '@hungpvq/map-dataset/raster';

const points = createGeoJsonDataset({
  name: 'Cities',
  geojson: geojsonData,
  type: 'point', // 'point' | 'line' | 'area' | 'symbol'
  color: '#ff6b6b',
});

const raster = createRasterUrlDataset({
  name: 'Tiles',
  tiles: ['https://example.com/tiles/{z}/{x}/{y}.png'],
  bounds: [102.144, 8.179, 109.464, 23.393],
  minzoom: 5,
  maxzoom: 15,
});

createGeoJsonDataset

OptionTypeRequiredRole
namestringyesRoot / list / source name
geojsonGeoJSONyesFeatures
type'point' | 'line' | 'area' | 'symbol'yesLayer style
colorcolornoList swatch + paint (random if omitted)
opacitynumbernoFill / line / circle opacity
exportbooleannoAdd list ⋮ Export (default true)
attributeTablebooleannoAdd list ⋮ Attribute table (default true)

Computes bbox from geojson, stores it on a bound node (createDatasetPartBoundComponent), and adds a Fill bound extra button on the list row (reads the bound part at click time). Also adds an identify node with zoom-to-bounds and show-detail menus, a per-layer Identify extra toggle (scoped IdentifyControl), plus list ⋮ Export and Attribute table unless you pass export: false / attributeTable: false. Mount IdentifyControl + ComponentManagementControl to use identify / those dialogs.

To change the fit target later without rebuilding the menu:

ts
import { findSiblingOrNearestLeaf } from '@hungpvq/map-dataset';

const bound = findSiblingOrNearestLeaf(
  list,
  (node) => node.type === 'bound',
);
bound?.setData([105.5, 20.5, 106.5, 21.5]);

createRasterUrlDataset

OptionTypeRequiredRole
namestringyesRoot name
tilesstring[]yesTile URLs with {z}/{x}/{y}
bounds[w, s, e, n]noMapLibre bounds
minzoom / maxzoomnumbernoZoom range

Events: none. Add with useMapDataset(map.id).addDataset(dataset). For a custom tree (menus, groups), use create-dataset.