All Projects → urbica → react-map-gl-cluster

urbica / react-map-gl-cluster

Licence: MIT license
Urbica React Cluster Component for Mapbox GL JS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-map-gl-cluster

angular-mapboxgl-directive
AngularJS directive for Mapbox GL
Stars: ✭ 43 (+59.26%)
Mutual labels:  map, mapbox-gl, maps, mapbox-gl-js
Editor
An open source visual editor for the 'Mapbox Style Specification'
Stars: ✭ 1,167 (+4222.22%)
Mutual labels:  mapbox-gl, maps, mapbox-gl-js
Mapdeck
R interface to Deck.gl and Mapbox
Stars: ✭ 296 (+996.3%)
Mutual labels:  mapbox-gl, maps, mapbox-gl-js
deck.gl-time-series-widget
A React Time Slider implementation for DECK.GL - (non)temporal data - by CPU filtering ⌛
Stars: ✭ 19 (-29.63%)
Mutual labels:  mapbox-gl, maps, mapbox-gl-js
Mapbox Gl Native Android
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
Stars: ✭ 135 (+400%)
Mutual labels:  map, mapbox-gl, maps
React Map Gl
React friendly API wrapper around MapboxGL JS
Stars: ✭ 6,244 (+23025.93%)
Mutual labels:  map, mapbox-gl, mapbox-gl-js
Osm Liberty
A free Mapbox GL basemap style for everyone
Stars: ✭ 231 (+755.56%)
Mutual labels:  mapbox-gl, maps, mapbox-gl-js
React Map Gl
React Component Library for Mapbox GL JS
Stars: ✭ 298 (+1003.7%)
Mutual labels:  map, mapbox-gl, mapbox-gl-js
React Native Map Clustering
React Native map clustering both for Android and iOS.
Stars: ✭ 450 (+1566.67%)
Mutual labels:  map, maps, clustering
Mapbox Gl Native
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Stars: ✭ 4,091 (+15051.85%)
Mutual labels:  map, mapbox-gl, maps
Cluster
Easy Map Annotation Clustering 📍
Stars: ✭ 1,132 (+4092.59%)
Mutual labels:  map, clustering, cluster
Mapbox Gl Js
Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
Stars: ✭ 8,017 (+29592.59%)
Mutual labels:  map, mapbox-gl, mapbox-gl-js
React Mapbox Gl
A React binding of mapbox-gl-js
Stars: ✭ 1,683 (+6133.33%)
Mutual labels:  map, mapbox-gl, mapbox-gl-js
Openrailwaymap
An OpenStreetMap-based project for creating a map of the world's railway infrastructure.
Stars: ✭ 150 (+455.56%)
Mutual labels:  map, maps
s60-maps
Yet another maps for Symbian OS
Stars: ✭ 27 (+0%)
Mutual labels:  map, maps
Openglobus
JavaScript 3d maps and geospatial data visualization engine library.
Stars: ✭ 199 (+637.04%)
Mutual labels:  map, maps
Ahorn
Visual Map Maker and Level Editor for the game Celeste
Stars: ✭ 132 (+388.89%)
Mutual labels:  map, maps
Azuremapscodesamples
A set of code samples for the Azure Maps web control.
Stars: ✭ 167 (+518.52%)
Mutual labels:  map, maps
Gmapsfx
Java API for using Google Maps within a JavaFX application.
Stars: ✭ 233 (+762.96%)
Mutual labels:  map, maps
Placepicker
Free Android Map Place Picker alternative using Geocoder instead of Google APIs
Stars: ✭ 126 (+366.67%)
Mutual labels:  map, maps

Urbica React Mapbox GL Cluster

Build Status npm npm

Cluster component for Urbica React Components Library for Mapbox GL JS.

Installation

npm install mapbox-gl supercluster @urbica/react-map-gl @urbica/react-map-gl-cluster

...or if you are using yarn:

yarn add mapbox-gl supercluster @urbica/react-map-gl @urbica/react-map-gl-cluster

Usage

import { randomPoint } from '@turf/random';
import MapGL, { Marker } from '@urbica/react-map-gl';
import Cluster from '@urbica/react-map-gl-cluster';
import 'mapbox-gl/dist/mapbox-gl.css';

const bbox = [-160, -70, 160, 70];
const points = randomPoint(50, { bbox }).features;
points.forEach((point, index) => (point.id = index));

initialState = {
  viewport: {
    latitude: 0,
    longitude: 0,
    zoom: 0
  }
};

const style = {
  width: '20px',
  height: '20px',
  color: '#fff',
  background: '#1978c8',
  borderRadius: '20px',
  textAlign: 'center'
};

const ClusterMarker = ({ longitude, latitude, pointCount }) => (
  <Marker longitude={longitude} latitude={latitude}>
    <div style={{ ...style, background: '#f28a25' }}>{pointCount}</div>
  </Marker>
);

<MapGL
  style={{ width: '100%', height: '400px' }}
  mapStyle='mapbox://styles/mapbox/light-v9'
  accessToken={MAPBOX_ACCESS_TOKEN}
  onViewportChange={viewport => setState({ viewport })}
  {...state.viewport}
>
  <Cluster radius={40} extent={512} nodeSize={64} component={ClusterMarker}>
    {points.map(point => (
      <Marker
        key={point.id}
        longitude={point.geometry.coordinates[0]}
        latitude={point.geometry.coordinates[1]}
      >
        <div style={style} />
      </Marker>
    ))}
  </Cluster>
</MapGL>;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].