Top Related Projects
Google map library for react that allows rendering components as markers :tada:
React friendly API wrapper around MapboxGL JS
React components for Leaflet maps
Quick Overview
Pigeon Maps is a lightweight, customizable React component for rendering interactive maps without external dependencies. It provides a simple and flexible solution for integrating maps into React applications, offering a range of features such as markers, overlays, and custom tile providers.
Pros
- Lightweight and dependency-free, resulting in smaller bundle sizes
- Highly customizable with support for custom tile providers and styling
- Easy to integrate into React applications
- Supports touch interactions and is mobile-friendly
Cons
- Limited built-in features compared to more comprehensive mapping libraries
- May require additional effort for complex mapping scenarios
- Documentation could be more extensive
- Smaller community compared to more popular mapping solutions
Code Examples
- Basic map usage:
import { Map } from 'pigeon-maps'
function MyMap() {
return (
<Map height={300} defaultCenter={[50.879, 4.6997]} defaultZoom={11} />
)
}
- Adding a marker:
import { Map, Marker } from 'pigeon-maps'
function MapWithMarker() {
return (
<Map height={300} defaultCenter={[50.879, 4.6997]} defaultZoom={11}>
<Marker width={50} anchor={[50.879, 4.6997]} />
</Map>
)
}
- Custom tile provider:
import { Map } from 'pigeon-maps'
const myTileProvider = (x, y, z) => {
return `https://my-custom-tile-server.com/${z}/${x}/${y}.png`
}
function CustomMap() {
return (
<Map
height={300}
defaultCenter={[50.879, 4.6997]}
defaultZoom={11}
provider={myTileProvider}
/>
)
}
Getting Started
To use Pigeon Maps in your React project, follow these steps:
-
Install the package:
npm install pigeon-maps
-
Import and use the Map component in your React application:
import React from 'react' import { Map } from 'pigeon-maps' function App() { return ( <div> <h1>My Map</h1> <Map height={400} defaultCenter={[50.879, 4.6997]} defaultZoom={11} /> </div> ) } export default App
This will render a basic map centered on the specified coordinates. You can further customize the map by adding markers, overlays, or implementing custom behaviors using the provided components and props.
Competitor Comparisons
Google map library for react that allows rendering components as markers :tada:
Pros of google-map-react
- Utilizes Google Maps API, providing access to extensive map data and features
- Offers seamless integration with other Google services and APIs
- Provides a familiar user interface that many users are accustomed to
Cons of google-map-react
- Requires an API key and may incur costs for heavy usage
- Dependency on Google's services and potential privacy concerns
- Limited customization options compared to open-source alternatives
Code Comparison
google-map-react:
import GoogleMapReact from 'google-map-react';
<GoogleMapReact
bootstrapURLKeys={{ key: 'YOUR_API_KEY' }}
defaultCenter={{ lat: 59.95, lng: 30.33 }}
defaultZoom={11}
>
<Marker lat={59.955413} lng={30.337844} text="My Marker" />
</GoogleMapReact>
pigeon-maps:
import { Map, Marker } from 'pigeon-maps'
<Map height={300} defaultCenter={[50.879, 4.6997]} defaultZoom={11}>
<Marker width={50} anchor={[50.879, 4.6997]} />
</Map>
The code comparison shows that google-map-react requires an API key, while pigeon-maps does not. Both libraries offer similar basic functionality for rendering maps and markers, but with slightly different syntax and prop names.
React friendly API wrapper around MapboxGL JS
Pros of react-map-gl
- Built on top of Mapbox GL JS, offering advanced mapping features and high performance
- Extensive documentation and a larger community for support
- Seamless integration with other Uber's visualization libraries (e.g., deck.gl)
Cons of react-map-gl
- Requires a Mapbox access token, which may incur costs for high-volume usage
- Heavier package size due to its comprehensive feature set
- Steeper learning curve for developers new to Mapbox ecosystem
Code Comparison
react-map-gl:
import Map from 'react-map-gl';
<Map
mapboxAccessToken={MAPBOX_TOKEN}
initialViewState={{
longitude: -122.4,
latitude: 37.8,
zoom: 14
}}
style={{width: 600, height: 400}}
mapStyle="mapbox://styles/mapbox/streets-v9"
/>
Pigeon Maps:
import { Map } from 'pigeon-maps'
<Map
height={400}
defaultCenter={[37.8, -122.4]}
defaultZoom={14}
/>
The code comparison shows that Pigeon Maps has a simpler setup, not requiring an access token. However, react-map-gl offers more customization options out of the box, such as specifying map styles.
React components for Leaflet maps
Pros of react-leaflet
- Built on top of Leaflet, a well-established mapping library with extensive features and plugins
- Larger community and more frequent updates
- Better documentation and examples
Cons of react-leaflet
- Heavier package size due to Leaflet dependency
- Steeper learning curve for those unfamiliar with Leaflet
- Less control over low-level map rendering
Code Comparison
react-leaflet:
import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'
<MapContainer center={[51.505, -0.09]} zoom={13} scrollWheelZoom={false}>
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
<Marker position={[51.505, -0.09]}>
<Popup>A pretty CSS3 popup. <br /> Easily customizable.</Popup>
</Marker>
</MapContainer>
pigeon-maps:
import { Map, Marker } from 'pigeon-maps'
<Map height={300} center={[50.879, 4.6997]} zoom={12}>
<Marker width={50} anchor={[50.879, 4.6997]} />
</Map>
The code comparison shows that pigeon-maps has a simpler API and requires less boilerplate, while react-leaflet offers more built-in components and customization options out of the box.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Pigeon Maps - ReactJS maps without external dependencies
Demo: https://pigeon-maps.js.org/ (using maps from MapTiler, OSM and Stamen)
What is it?
Are you tired of waiting 3 seconds to parse 200kb of Google Maps JavaScript just to display a few tiles and a marker? 140kb of minified Leaflet too much?
Welcome to the club!
This project aims to provide a performance-first React-centric extendable map engine.
We're currently at:
Implemented:
- Show tiles
- Arbitrary overlays (markers, etc)
- Move the map by dragging
- Move the map by touch on mobile
- Zooming with the scroll wheel
- Zooming by touch
- Fractional zooming (e.g. to level 12.2)
- Zoom without flickering (keep old tiles until new ones load)
- Smooth animated zooming
- Slide when dragging and letting go
- Event handling (clicks, etc)
- Double click and double tap zooming
- Option to block dragging with one finger and mouse wheel scrolling without holding meta key
- Enable/disable touch and mouse events as needed - you could make a 100% static server rendered react map
- Support for 100% width/height containers
- Markers
- Overlays
- Draggable Overlays
- Zoom Controls
Missing:
- Double tap and then swipe touch zooming
- Many other components
Install
Yeah, but why "pigeon"??
Pigeons are experts in magnetoreception. Good pigeons can find their way home from anywhere.
Magnets were essential in making the first maps. With a good map you can find your way home from anywhere.
Thus, pigeon
.
Top Related Projects
Google map library for react that allows rendering components as markers :tada:
React friendly API wrapper around MapboxGL JS
React components for Leaflet maps
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot