cartography
БесплатноБез исполняемых скриптовНе проверенImplemente des cartes interactives avec Leaflet et react-leaflet. Couvre markers, clusters, popups, geolocalisation, fond de carte MapLibre/OpenStreetMap et…
Об этом скилле
Cartographie / Maps
Guide pour implementer des cartes interactives dans admin-next/ avec Leaflet, react-leaflet et MapLibre (fond de carte OpenStreetMap).
Stack technique
- leaflet : 1.9.4 - Librairie de cartographie
- react-leaflet : 4.2.1 - Binding React pour Leaflet
- react-leaflet-markercluster : Clustering de markers
- MapLibre GL (via
@maplibre/maplibre-gl-leaflet) : fond de carte vectoriel OpenStreetMap/OpenFreeMap, style versionne danspublic/map-style.json. Mapbox a ete retire : voirADR/001-map_stack_maplibre_openstreetmap.md
Structure recommandee
components/
└── MyFeature/
└── Map/
├── MyFeatureMap.tsx # Wrapper avec Suspense
├── MyFeatureMapContainer.tsx # MapContainer + logique
├── MyFeatureMapMarkers.tsx # Markers avec pagination
├── MyFeatureMarker.tsx # Marker individuel
└── MapControls.tsx # Controles custom
Composant Map de base
// MyFeatureMap.tsx
import { Suspense } from 'react'
import { Spinner, Box } from '@cap-collectif/ui'
import dynamic from 'next/dynamic'
// IMPORTANT: Leaflet ne supporte pas le SSR
const MyFeatureMapContainer = dynamic(
() => import('./MyFeatureMapContainer'),
{ ssr: false }
)
type Props = {
query: MyFeatureMap_query$key
}
export const MyFeatureMap: React.FC<Props> = ({ query }) => {
return (
<Box height="500px" width="100%" position="relative">
<Suspense fallback={<MapSkeleton />}>
<MyFeatureMapContainer query={query} />
</Suspense>
</Box>
)
}
const MapSkeleton = () => (
<Box
height="100%"
width="100%"
bg="gray.100"
display="flex"
alignItems="center"
justifyContent="center"
>
<Spinner />
</Box>
)
MapContainer
// MyFeatureMapContainer.tsx
import 'leaflet/dist/leaflet.css'
import type L from 'leaflet'
import { MapContainer, useMapEvents } from 'react-leaflet'
import { useIntl } from 'react-intl'
import { graphql, useFragment } from 'react-relay'
import { CapcoTileLayer } from '@utils/leaflet'
const FRAGMENT = graphql`
fragment MyFeatureMapContainer_query on Query
@argumentDefinitions(
bounds: { type: "String" }
# ... autres filtres
) {
...MyFeatureMapMarkers_query @arguments(bounds: $bounds)
}
`
const DEFAULT_CENTER: [number, number] = [46.603354, 1.888334] // France
const DEFAULT_ZOOM = 6
const MAX_ZOOM = 18
type Props = {
query: MyFeatureMapContainer_query$key
}
export const MyFeatureMapContainer: React.FC<Props> = ({ query: queryRef }) => {
const data = useFragment(FRAGMENT, queryRef)
const intl = useIntl()
const mapLabel = intl.formatMessage({ id: 'global.card' })
// Leaflet makes the container focusable (keyboard panning): give it a name
const onMapReady = React.useCallback(
(map: L.Map | null) => {
if (!map) return
map.getContainer().setAttribute('role', 'region')
map.getContainer().setAttribute('aria-label', mapLabel)
},
[mapLabel],
)
return (
<MapContainer
ref={onMapReady}
center={DEFAULT_CENTER}
zoom={DEFAULT_ZOOM}
maxZoom={MAX_ZOOM}
style={{ height: '100%', width: '100%' }}
scrollWheelZoom={true}
zoomControl={false} // On utilise des controles custom
>
<CapcoTileLayer />
<MapEventHandler />
<MyFeatureMapMarkers query={data} />
<MapControls />
</MapContainer>
)
}
// Hook pour ecouter les events de la map
const MapEventHandler: React.FC = () => {
const map = useMapEvents({
moveend: () => {
const bounds = map.getBounds()
const boundsString = `${bounds.getSouthWest().lat},${bounds.getSouthWest().lng},${bounds.getNorthEast().lat},${bounds.getNorthEast().lng}`
// Mettre a jour les filtres URL
},
zoomend: () => {
// Logique au changement de zoom
},
})
return null
}
Markers avec clustering
// MyFeatureMapMarkers.tsx
import { Marker, Popup } from 'react-leaflet'
import MarkerClusterGroup from 'react-leaflet-markercluster'
import { graphql, usePaginationFragment } from 'react-relay'
import L from 'leaflet'
const FRAGMENT = graphql`
fragment MyFeatureMapMarkers_query on Query
@argumentDefinitions(
count: { type: "Int!", defaultValue: 100 }
cursor: { type: "String" }
bounds: { type: "String" }
)
@refetchable(queryName: "MyFeatureMapMarkersPaginationQuery") {
items(first: $count, after: $cursor, bounds: $bounds)
@connection(key: "MyFeatureMapMarkers_items") {
edges {
node {
id
title
address {
lat
lng
}
}
}
}
}
`
// Configuration du clustering
const CLUSTER_OPTIONS = {
spiderfyOnMaxZoom: true,
zoomToBoundsOnClick: true,
maxClusterRadius: 30,
spiderfyDistanceMultiplier: 4,
showCoverageOnHover: false,
}
export const MyFeatureMapMarkers: React.FC<Props> = ({ query: queryRef }) =>
Установить cartography в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл cartography?
Implemente des cartes interactives avec Leaflet et react-leaflet. Couvre markers, clusters, popups, geolocalisation, fond de carte MapLibre/OpenStreetMap et accessibilite.
Как установить скилл cartography?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cartography запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic