Neura UI

Loading…

 Logo

Map

A native map with no tile provider. It draws open data, paints its own looks, colours countries by value, places markers, splits a focused country into city zones, and draws a country's subdivisions down to its municipalities.

World

Drag to pan, scroll or pinch to zoom, and use the buttons. The land and lakes come from Natural Earth and grow finer as you zoom in. The looks switcher paints the map itself.
blade
<neura::map
    :center="[20, 10]"
    :zoom="1.6"
    map-style="standard"
    :map-styles="['standard', 'atlas', 'blueprint', 'dots']"
    height="360px"
    label="World map"
/>

Values

Pass ISO country codes to values. The map joins them on ISO_A2_EH, then ISO_A2, and paints a scale. Hover a country for its name and value.
blade
<neura::map
    map-style="atlas"
    :values="[
        'US' => 420,
        'FR' => 140,
        'DE' => 190,
        'JP' => 200,
    ]"
    :fit="true"
    height="360px"
/>

Markers

Each marker needs lat and lng. An optional popup opens on click. Values and markers travel in data-map, so a Livewire update redraws them without rebuilding the map.
blade
<neura::map
    :markers="[
        [
            'lat' => 40.71,
            'lng' => -74.01,
            'label' => 'New York',
            'popup' => 'Americas hub · 42 people',
            'color' => 'primary',
        ],
        [
            'lat' => 51.51,
            'lng' => -0.13,
            'label' => 'London',
            'popup' => 'EMEA hub · 28 people',
            'color' => 'success',
        ],
    ]"
    :fit="true"
/>

One country

country frames that country alone and loads its cities from Natural Earth’s populated places. Each city gets its own colour, or the shade from city-values. The country is split into the zone of each city — the part closer to it — with lines between them.
blade
<neura::map
    country="FR"
    map-style="paper"
    :city-values="[
        'Paris' => 220,
        'Lyon' => 95,
        'Marseille' => 80,
        'Toulouse' => 60,
    ]"
    height="420px"
/>

Zones off

Pass :zones="false" to keep only the city dots and their labels. The Voronoi split is drawn by the map when a country is focused; it does nothing on a world view.
blade
<neura::map
    country="FR"
    map-style="atlas"
    :city-values="$cityValues"
    :zones="false"
    height="420px"
/>

Subdivisions

divisions draws the subdivisions of the focused country: states for its first level (French departments, US states, German Länder) with their ISO 3166-2 code. Each division gets a colour from colors (a status, keyed by key, code or name) and tooltip lines from details. Labels show the code; label-key="name" shows the name. highlight colours the hovered and selected divisions.
javascript
<neura::map
    country="FR"
    divisions="states"
    :colors="[
        '33' => 'success-500', // booked
        '18' => 'success-200', // open
        'FR-75' => 'success',  // key, code or name: FR-75, 75 or Paris
    ]"
    :details="[
        '18' => [
            '295 · Savelys PAC PQ · 40 EUR · Daily 10 / 25',
            '731 · Ensol PAC PQ · 50 EUR · Daily 0 / 10',
        ],
    ]"
    highlight="warning"
    :selected="['18']"
    height="520px"
/>

Drill down

drill-down names the finer level a click opens: the map frames the division and draws its own divisions inside, adm5 being the French communes. The back button or Escape returns to the country. Each click dispatches map-division-click, ready for Livewire.
blade
<neura::map
    country="FR"
    divisions="states"
    drill-down="adm5"
    :colors="$coverage"
    :details="$campaigns"
    x-on:map-division-click="$wire.selectDepartment($event.detail.key)"
/>

<!-- $event.detail: key (FR-18), code (18), name, level, parent, value, properties -->

Levels and sources

Subdivisions come from worldwide open data, so every country works. Nothing is downloaded up front: the first time a country is asked for, the server fetches its source once, keeps that country, lightens the outlines to map precision and splits the finer levels by parent, so opening one department loads its communes alone. Every later request is a file from disk.
Level Source In France
states Natural Earth admin-1, with ISO 3166-2 codes 101 departments (FR-18, code 18), with their region
adm1 geoBoundaries 13 regions
adm2 geoBoundaries 96 departments, by name
adm3 / adm4 geoBoundaries 320 arrondissements / 2 054 cantons
adm5 geoBoundaries 35 010 communes
Preparing France takes a couple of seconds for its departments and a few more the first time a department is opened (35 010 communes are split at once); memory stays low because the sources are read feature by feature. The files live in storage/app/neura-kit/map; config('neura-kit.map.divisions') sets that path, the precision kept (4 decimals, about 11 m) and the source URLs. The route is GET /neura-kit/map/divisions/{country}/{level}, with ?within=FR-18&of=states for the divisions of one parent. Natural Earth is public domain; geoBoundaries data is under open licences and credited on the map.

Looks

Six built-in looks: standard (follows the kit tokens), dark, atlas, blueprint, paper, and dots. Add your own through the Packs\Map\Style pack.
blade
Blueprint
Dots
<neura::map map-style="blueprint" :controls="false" />
<neura::map map-style="dots" :controls="false" />

Events

The map dispatches Alpine / Livewire events from the root: map-click, map-feature-click, map-marker-click, map-city-click, map-move, and map-style. With subdivisions, also map-division-click, map-drill (a division opened) and map-undrill (back to the country).
blade
<div
    x-on:map-feature-click="…"
    x-on:map-marker-click="…"
    x-on:map-city-click="…"
    x-on:map-style="…"
>
    <neura::map country="FR" :city-values="$cityValues" />
</div>

Props

Prop Default Role
center [20, 0] Latitude and longitude of the first view
zoom 2 Initial zoom level
min-zoom / max-zoom 1 / 7 (11 with drill-down) Zoom limits
map-style standard Look: standard, dark, atlas, blueprint, paper, dots
map-styles null Looks offered in the switcher
land / lakes countries / lakes Dataset name, URL, GeoJSON, or false to hide
geojson null GeoJSON or TopoJSON overlay (URL or data)
country null ISO code that frames one country and its cities
cities places when country is set, without divisions Dataset for cities, or false to hide them
zones true When a country is focused, split it into each city’s zone
divisions null Subdivisions of the focused country: states, adm1 … adm5
drill-down null The finer level a click on a division opens (adm5 for the French communes)
label-key code What a division's label shows: code, name, or false
colors [] Division (key, code or name) → palette name or CSS colour; wins over values
details [] Division → tooltip line, lines, or ['title' => …, 'lines' => […]]
selected [] Divisions drawn in the highlight colour
highlight primary Colour of hovered and selected divisions: palette name or CSS colour
values [] ISO code → number, colours the countries
city-values [] City name → number, colours the cities
markers [] lat, lng, and optional label, popup, color
fit false Frame the values, markers, or overlay
graticule / labels true Grid lines and country labels
scroll-zoom true Wheel zoom over the map
controls true Zoom buttons
height 420px CSS height of the map
variant card card draws a border; minimal is bare
label null Accessible name of the map region