1.0.0 • Published 2 years ago

@amsterdam/arm-core v1.0.0

Weekly downloads
515
License
MPL-2.0
Repository
github
Last release
2 years ago

ARM Core

Part of Amsterdam React Maps library.

This is the link to the story book demo site with examples

Installation

Add this package to your project by running:

npm install --save @amsterdam/arm-core

Usage

import 'leaflet/dist/leaflet.css' // make sure this is always included!
import { Map, BaseLayer, GeoJSON, ViewerContainer, Zoom } from '@amsterdam/arm-core'

const json = {
    type: 'Feature',
    properties: {
      name: 'Amsterdam',
    },
    geometry: {
      type: 'Point',
      coordinates: [52, 4],
    },
  }

const MyComponent = () => (
  <Map fullScreen>
    <GeoJSON args={[json]} />
    <ViewerContainer bottomRight={<Zoom />} />
    <BaseLayer />
  </Map>
)

export default MyComponent

And when you want to use mapInstance in a different component:

...
import { useMapInstance } from '@amsterdam/arm-core';

const Search = () => (
    const mapInstance = useMapInstance();
    
    useEffect(() => {
      mapInstance.flyTo(x,y)
    }, [mapInstance])
)

export default Search

Exports components

  • Map: props options?, fullScreen?, setInstance?
  • BaseLayerToggle
  • ControlButton: extends Button
  • MapPanel
  • Scale: props options
  • ViewerContainer: props bottomLeft?, topLeft?, topRight?, bottomRight?
  • Marker: props latLng, options?, setInstance?
  • Zoom: props tabIndexIn?, tabIndexOut?

Exports leaflet layers

  • BaseLayer: props baseLayer?, options?, setInstance?
  • GeoJSON: props args, options?, setInstance?
  • GeoJSONLayer: props url, options, setInstance?
  • RDGeoJSON: props geometry, properties?, options?, setInstance?
  • WfsLayer: props url, options, zoomLevel, setInstance?

Exports hooks

  • useMapInstance()
  • useMapEvents(events?)
  • useEvents(instance, events?)
  • useGetAddressFromLatLng()
  • usePanToLatLng()
  • useStateRef()

Exports services

  • fetchWithAbort()
  • getBBox(mapInstance)
  • getCrsRd()

Exports constants

  • AMSTERDAM_LAYERS
  • AERIAL_AMSTERDAM_LAYERS
  • MIN_ZOOM_LEVEL
  • MAX_ZOOM_LEVEL
AMSTERDAM_MAPS_OPTIONS = {
  center: [52.3731081, 4.8932945],
  zoom: 10,
  maxZoom: 16,
  minZoom: 3,
  zoomControl: false,
  crs: getCrsRd(),
  maxBounds: [
    [52.25168, 4.64034],
    [52.50536, 5.10737],
  ],
}
1.0.0

2 years ago

0.10.0

2 years ago

0.10.1

2 years ago

0.10.2

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

3 years ago

0.6.1-alpha.71

3 years ago

0.6.1-alpha.70

3 years ago

0.6.1-alpha.53

3 years ago

0.6.1-alpha.29

3 years ago

0.6.1-alpha.28

3 years ago

0.5.2-alpha.105

3 years ago

0.6.1-alpha.8

3 years ago

0.6.1-alpha.19

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.5.1

3 years ago

0.4.1

3 years ago

0.4.0

4 years ago