All Projects → venits → React Native Map Clustering

venits / React Native Map Clustering

React Native map clustering both for Android and iOS.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Map Clustering

js-markerclusterer
Create and manage clusters for large amounts of markers
Stars: ✭ 92 (-79.56%)
Mutual labels:  maps, clustering, markers
react-map-gl-cluster
Urbica React Cluster Component for Mapbox GL JS
Stars: ✭ 27 (-94%)
Mutual labels:  map, maps, clustering
mapus
A map tool with real-time collaboration 🗺️
Stars: ✭ 2,687 (+497.11%)
Mutual labels:  map, maps
o.map
Open Street Map app - KaiOS
Stars: ✭ 51 (-88.67%)
Mutual labels:  map, maps
Leaflet.freedraw
🌏 FreeDraw allows the free-hand drawing of shapes on your Leaflet.js map layer – providing an intuitive and familiar UX for creating geospatial boundaries similar to Zoopla and others. Included out-of-the-box is the concaving of polygons, polygon merging and simplifying, as well as the ability to add edges and modify existing shapes.
Stars: ✭ 446 (-0.89%)
Mutual labels:  maps, markers
s60-maps
Yet another maps for Symbian OS
Stars: ✭ 27 (-94%)
Mutual labels:  map, maps
mapgen
map generator stuff
Stars: ✭ 26 (-94.22%)
Mutual labels:  map, maps
react-vector-maps
🗺 A React component for interactive vector maps of the world and 100+ countries
Stars: ✭ 112 (-75.11%)
Mutual labels:  map, maps
leaflet-tag-filter-button
Adds tag filter control for layers (marker, geojson features etc.) to LeafLet.
Stars: ✭ 48 (-89.33%)
Mutual labels:  map, markers
React Native Maps Super Cluster
A Clustering-enabled map for React Native
Stars: ✭ 284 (-36.89%)
Mutual labels:  clustering, maps
angular-mapboxgl-directive
AngularJS directive for Mapbox GL
Stars: ✭ 43 (-90.44%)
Mutual labels:  map, maps
Leaflet.markercluster
Marker Clustering plugin for Leaflet
Stars: ✭ 3,305 (+634.44%)
Mutual labels:  clustering, map
vaguely-rude-places
The map of Vaguely Rude Place Names
Stars: ✭ 19 (-95.78%)
Mutual labels:  map, maps
Dual-color-Polyline-Animation
This library will help to show the polyline in dual color similar as Uber.
Stars: ✭ 73 (-83.78%)
Mutual labels:  maps, markers
leaflet.minichart
Leaflet.minichart is a leaflet plugin for adding to a leaflet map small animated charts
Stars: ✭ 27 (-94%)
Mutual labels:  map, maps
NonEmptyCollections
A type-safe implementation for collections that cannot be empty. Life is too short for emptiness-checks!
Stars: ✭ 45 (-90%)
Mutual labels:  map, maps
Offlinemap
基于MySQL + Node.js + Leaflet的离线地图展示,支持百度、谷歌、高德、腾讯地图
Stars: ✭ 343 (-23.78%)
Mutual labels:  map, maps
coronavirus-map-dashboard
🦠 Coronavirus (COVID-19) Map Dashboard using coronavirus-tracker-api
Stars: ✭ 41 (-90.89%)
Mutual labels:  map, maps
map-machine
Python renderer for OpenStreetMap with custom icons intended to display as many map features as possible
Stars: ✭ 82 (-81.78%)
Mutual labels:  map, maps
Maptalks.js
A light and plugable JavaScript library for integrated 2D/3D maps.
Stars: ✭ 3,377 (+650.44%)
Mutual labels:  map, maps

React Native Map Clustering

React Native module that handles map clustering for you.

Works with Expo and react-native-cli 🚀

This repo is proudly sponsored by:


React Native Templates & Starter Kits and Apps for easier start.

Demo

Demo

Installation

npm install react-native-map-clustering react-native-maps --save
// yarn add react-native-map-clustering react-native-maps

Full example

import React from "react";
import MapView from "react-native-map-clustering";
import { Marker } from "react-native-maps";

const INITIAL_REGION = {
  latitude: 52.5,
  longitude: 19.2,
  latitudeDelta: 8.5,
  longitudeDelta: 8.5,
};

const App = () => (
  <MapView initialRegion={INITIAL_REGION} style={{ flex: 1 }}>
    <Marker coordinate={{ latitude: 52.4, longitude: 18.7 }} />
    <Marker coordinate={{ latitude: 52.1, longitude: 18.4 }} />
    <Marker coordinate={{ latitude: 52.6, longitude: 18.3 }} />
    <Marker coordinate={{ latitude: 51.6, longitude: 18.0 }} />
    <Marker coordinate={{ latitude: 53.1, longitude: 18.8 }} />
    <Marker coordinate={{ latitude: 52.9, longitude: 19.4 }} />
    <Marker coordinate={{ latitude: 52.2, longitude: 21 }} />
    <Marker coordinate={{ latitude: 52.4, longitude: 21 }} />
    <Marker coordinate={{ latitude: 51.8, longitude: 20 }} />
  </MapView>
);

export default App;

Props

Name Type Default Note
clusterColor String #00B386 Background color of cluster.
clusterTextColor String #FFFFFF Color of text in cluster.
clusterFontFamily String undefined Font family of text in cluster.
onClusterPress(cluster, markers) Function () => {} Allows you to control cluster on click event. Function returns information about cluster and its markers.
tracksViewChanges Bool false Sets whether the cluster markers should track view changes. It's turned off by default to improve cluster markers performance.
width Number window width map's width.
height Number window height map's height.
radius Number window.width * 6% SuperCluster radius.
extent Number 512 SuperCluster extent.
minZoom Number 1 SuperCluster minZoom.
maxZoom Number 20 SuperCluster maxZoom.
minPoints Number 2 SuperCluster minPoints.
preserveClusterPressBehavior Bool false If set to true, after clicking on cluster it will not be zoomed.
edgePadding Object { top: 50, left: 50, bottom: 50, right: 50 } Edge padding for react-native-maps's fitToCoordinates method, called in onClusterPress for fitting to pressed cluster children.
animationEnabled Bool true Animate imploding/exploding of clusters' markers and clusters size change. Works only on iOS.
layoutAnimationConf LayoutAnimationConfig LayoutAnimation.Presets.spring LayoutAnimation.Presets.spring
onRegionChangeComplete(region, markers) Function () => {} Called when map's region changes. In return you get current region and markers data.
onMarkersChange(markers) Function () => {} Called when markers change. In return you get markers data.
superClusterRef MutableRefObject {} Return reference to supercluster library. You can read more about options it has here.
clusteringEnabled Bool true Set true to enable and false to disable clustering.
spiralEnabled Bool true Set true to enable and false to disable spiral view.
renderCluster Function undefined Enables you to render custom cluster with custom styles and logic.
spiderLineColor String #FF0000 Enables you to set color of spider line which joins spiral location with center location.

How to animate to region?

Full example of how to use animateToRegion().

import React, { useRef } from "react";
import { Button } from "react-native";
import MapView from "react-native-map-clustering";
import { Marker } from "react-native-maps";

const INITIAL_REGION = {
  latitude: 52.5,
  longitude: 19.2,
  latitudeDelta: 8.5,
  longitudeDelta: 8.5,
};

const App = () => {
  const mapRef = useRef();

  const animateToRegion = () => {
    let region = {
      latitude: 42.5,
      longitude: 15.2,
      latitudeDelta: 7.5,
      longitudeDelta: 7.5,
    };

    mapRef.current.animateToRegion(region, 2000);
  };

  return (
    <>
      <MapView
        ref={mapRef}
        initialRegion={INITIAL_REGION}
        style={{ flex: 1 }}
      />
      <Button onPress={animateToRegion} title="Animate" />
    </>
  );
};

export default App;

Support

Feel free to create issues and pull requests. I will try to provide as much support as possible over GitHub. In case of questions or problems, contact me at: [email protected]

Happy Coding 💖🚀

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].