React map library comparison
Tags: react, javascript
Published: 2020-01-15 17:13:13

---
title: React map library comparison
published: true
date: 2020-01-14 14:00:23 UTC
tags: react,javascript
canonical_url: https://blog.logrocket.com/react-map-library-comparison/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9bewhb0p33199tuejik9.png
---
**Written by [Siegfried Grimbeek](https://blog.logrocket.com/author/siegfriedgrimbeek/)**✏️

### Introduction 

Implementing an effective, efficient, and sustainable map solution can be a daunting task.

Rather than reinventing the wheel, it’s better to make use of existing solutions if your specific use case allows for it.

In this post we will investigate several existing React map libraries and compare them based on functionality, technology, and ease of use.

![map](https://blog.logrocket.com/wp-content/uploads/2020/01/map-nocdn.png)

### Which libraries should we compare?

Whenever I have to make a decision on what library or framework to use, my first step is to check out the Github “Awesome” repositories.

The Github “Awesome” repositories are a huge collection of “all things awesome” for a particular framework or programming language.

Some notable awesome repositories include [Awesome React](https://github.com/enaqx/awesome-react), [Awesome Vue.js](https://github.com/vuejs/awesome-vue), [awesome-graphql](https://github.com/chentsulin/awesome-graphql) and [Awesome JavaScript](https://github.com/sorrycc/awesome-javascript).

Checkout the full list of all awesome repositories [here](https://github.com/sindresorhus/awesome).

I made use of the [Awesome React](https://github.com/enaqx/awesome-react) repository. Under the maps category, there are a total of eleven different React map libraries, components, and wrappers listed.

Out of the eleven libraries listed on Awesome React, five were eliminated from this comparison because they haven’t been updated in nearly a year or more. This normally indicates that a project has depreciated or been abandoned.

That leaves us with six libraries, which is still a lot for a comparison.

However, after some consideration, I’ve decided that it would not be fair to omit any of the six as they are all still in active development and each one has a different set of functions, modules, and components.

[![LogRocket Free Trial Banner](https://i0.wp.com/blog.logrocket.com/wp-content/uploads/2017/03/f760c-1gpjapknnuyhu8esa3z0jga.png?resize=1200%2C280&ssl=1)](https://logrocket.com/signup/)

### A summary of each library

- [react-map-gl](https://github.com/uber/react-map-gl): 

react-map-gl is a suite of React components for [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js), a WebGL-powered vector and raster tile mapping library.

In addition to exposing MapboxGL functionality to React apps, react-map-gl also integrates seamlessly with [deck.gl.](https://deck.gl)

This library, as well as [deck.gl](https://deck.gl/), is developed and maintained by Uber.

- [Google Map React](https://github.com/google-map-react/google-map-react):

google-map-react is a component written over a small set of the [Google Maps API](https://developers.google.com/maps/). It allows you to render any React component on the Google Map.

It is fully isomorphic and can render on a server.

Additionally, it can render map components in the browser even if the Google Maps API is not loaded. It uses an internal, tweakable hover algorithm – every object on the map can be hovered.

- [React-mapbox-gl](https://github.com/alex3165/react-mapbox-gl):  

Factory function that returns a React Mapbox component.

Parameters of the factory function are static. Properties of your component are dynamic and get updated if they change between rendering.

- [React-Leaflet](https://github.com/PaulLeCam/react-leaflet):
  
React-Leaflet provides an abstraction of [Leaflet](http://leafletjs.com/) as [React components](https://facebook.github.io/react/).

It does not replace Leaflet, only leverages [React’s lifecycle methods](https://reactjs.org/docs/react-component.html#the-component-lifecycle) to call the relevant Leaflet handlers.

- [react-geo](https://github.com/terrestris/react-geo):  

A set of geo-related components to use in combination with [react](https://github.com/facebook/react), [antd](https://github.com/ant-design/ant-design) and [ol](https://github.com/openlayers/openlayers).

- [Pigeon Maps](https://github.com/mariusandra/pigeon-maps):  

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.

With the above information, one can already eliminate certain libraries based on the project requirements.

For example: if a project requirement is that the project makes use of free open source software, one can narrow down the choice of libraries to only those using [OpenStreetMap](https://www.openstreetmap.org/).

If the project already uses many Google products and wants to remain in this ecosystem, only the libraries using Google Maps need to be considered.

### Statistics and trends

Lets take a quick look at the [npm trends](https://www.npmtrends.com/react-map-gl-vs-google-map-react-vs-react-mapbox-gl-vs-react-leaflet-vs-@terrestris/react-geo-vs-pigeon-maps), which will give us an indication of how popular each library is based on their number of downloads in the last six months:

![React map](https://blog.logrocket.com/wp-content/uploads/2020/01/react-map-gl-nocdn.png)

It is clear that there is a big discrepancy between the number of downloads across the six libraries, ranging between a couple of hundred to nearly a hundred and twenty thousand.

The number of downloads always serves as a good indicator of a library’s popularity, but it definitely shouldn’t be the deciding factor.

Below are the statistics for each library (also from [npm trends](https://www.npmtrends.com/react-map-gl-vs-google-map-react-vs-react-mapbox-gl-vs-react-leaflet-vs-@terrestris/react-geo-vs-pigeon-maps)):

![stats](https://blog.logrocket.com/wp-content/uploads/2020/01/stats-nocdn.png)

Another good measure of popularity is how many times a library has been “starred” on GitHub.

A strange discrepancy is the amount of downloads vs. the stars for the pigeon-maps, as it is the third most “starred” library, but it got almost no downloads in the last six months.

This reinforces the idea that one should not base one’s choice solely on a single metric.

Size is another important factor to keep in mind. Most libraries are relatively small, with the exception of react-map-gl, which is 212.6 KB. If size matters, then it’s a definite no-go.

We can also tell that all of the libraries are in active development based on when they were last updated.

### Technology and functionality

[react-map-gl](https://github.com/uber/react-map-gl)  
**Map solution** : [MapBox](https://www.mapbox.com/)  
**Cost** : A very generous free tier, but prices can be found [here](https://www.mapbox.com/pricing/).  
**Documentation and demos** : Clear and concise documentation and great coding examples that can be found [here](https://uber.github.io/react-map-gl/).

**Functionality** : Exposes the entire [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/api/) functionality to React apps. React-map-gl also integrates seamlessly with [deck.gl](https://deck.gl/#/).

This means that this library is packed with functionality. It covers everything from events, interaction handlers, user interfaces, and all geography and geometry functionality.

**Takeaways** : This library is developed by Uber and probably has more functionality than most projects would ever require.

Maps can be dynamically styled, waypoints can be smoothly animated with the camera transition, and everything from heat maps to clusters can be plotted out on the map.

If your application will be very map-heavy and map-focused and there’s a budget for when it breaks through the free tier, this solution is definitely worth checking out.

[Google Map React](https://github.com/google-map-react/google-map-react)  
**Map solution** : [Google Maps](https://developers.google.com/maps/documentation)  
**Cost** : Pricing is available [here](https://cloud.google.com/maps-platform/pricing/).  
**Documentation and demos** : Limited (work in progress) documentation, but great examples covering most use cases can be found [here.](https://github.com/google-map-react/google-map-react)

**Functionality** : This library is built upon a limited set of the [Google Maps API](https://developers.google.com/maps/), exposing a very small set of the the functionality.

It allows you to render any React component on the Google Map. It is fully isomorphic and can render on a server, as well as on the client side. Additionally, it can render map components in the browser even if the Google Maps API is not loaded.

**Takeaways** : This library allows you to render React components on Google maps and that’s basically it.

So if you are building a directory listing application (think AirBnb), then this library will be a good fit.

While the functionality is limited, it does allow for click / hover interaction, custom markers, and event interaction.

Regarding the pricing options, one needs to consider whether it’s worth implementing Google Maps for such limited functionality as one could very easily achieve similar functionality with a free solution.

[React-mapbox-gl](https://github.com/alex3165/react-mapbox-gl)  
**Map solution** : [MapBox](https://www.mapbox.com/)  
**Cost:**  A very generous free tier, but prices can be found [here](https://www.mapbox.com/pricing/).  
**Documentation and demos** : Thorough documentation and demos — with the code — can be found [here](http://alex3165.github.io/react-mapbox-gl/).

**Functionality** : This library covers most of the [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/api/) functionality, which includes everything from events, interaction handlers, user interfaces, and all geography and geometry functionality. If any additional functionality is required, the documentation recommends accessing the original [mapbox-gl-js API](https://docs.mapbox.com/mapbox-gl-js/api).

**Takeaways** : Just like react-map-gl, this library is also built on MapBox, meaning that it too has everything from dynamic styling to heat maps, etc.

However, it is way smaller in size than react-map-gl, and it also allows you to tap into the original mapbox-gl-js API if you need to add additional functionality.

This library would be suitable for a map-heavy application that needs loads of functionality and customizations, but you should keep in mind that the technology that it’s built on implements a pay-per-use payment structure.

[React-Leaflet](https://github.com/PaulLeCam/react-leaflet)  
**Map solution** : Provider-agnostic, meaning you can use any map provider as long as you conform to its terms of use.  
**Cost** : One can use a free solution such as OpenStreetMap, or one of the commercial solutions.  
**Documentation and demos** : The documentation covers all functionality. There are coding examples that are part of the Git repo, but I did not find any demos online. The documentation and coding examples can be found [here](https://react-leaflet.js.org/en/).

**Functionality** : This library is built upon the [Leaflet.js](https://leafletjs.com/) plugin, which in itself is packed with functionality, including events, interaction handlers, user interfaces, vector layers, and all geography and geometry functionality.

**Takeaways** : This is an excellent solution if your project requires free open source alternatives such as Open Street Maps, but it does not bind you to any mapping solution.

The [Leaflet.js](https://leafletjs.com/) library upon which it’s built is feature-rich. It also has a great ecosystem of plugins and extensions that can easily be incorporated into a solution.

If open source — along with some serious functionality — is a project requirement, then this library is definitely a good option.

Again, I feel that this library is geared towards more serious map-focused applications and should not be implemented if all the functionality is not required.

[react-geo](https://github.com/terrestris/react-geo)  
**Map Solution** : Built with [OpenLayers](https://openlayers.org/), which can be used with OpenStreetMap-project and commercial products such as Bing Maps or Google Maps.  
**Cost:** One can use a free solution such as OpenStreetMap or one of the commercial solutions.  
Documentation and Demos: Thorough documentation of each component and great coding demos that can be found [here](https://terrestris.github.io/react-geo/docs/latest/index.html).  
**Functionality** : This library combines functionality available in the [OpenLayers](https://github.com/openlayers/openlayers) framework and the [Ant Design](https://github.com/ant-design/ant-design) library.

The [OpenLayers](https://github.com/openlayers/openlayers) framework is packed with features and functionality. As with Mapbox, the functionality includes everything from events, styling, and interactions.

**Takeaways** : This library feels like it is trying to do a little bit of everything, but not enough of anything. It combines map functionality with user interface functionality in the form of Ant Design.

Personally, I am a bit opposed to a library forcing a design system upon a project, but this could be a benefit if one is already using the Ant Design framework.

It is built with OpenLayers, making it free and open source, but I do not feel that this library is ready for production.

[Pigeon Maps](https://github.com/mariusandra/pigeon-maps)  
**Map solution** : [OpenStreetMap](https://wiki.openstreetmap.org/wiki/Main_Page)  
**Cost** : Free using [OpenStreetMap](https://www.openstreetmap.org/)  
**Documentation and demos** : Limited documentation and demo that can be found [here](https://pigeon-maps.js.org/).

**Functionality** : This library has all the basic functionality and more.

It is not as feature-rich as some of the other libraries we’ve reviewed, so for any more advanced scenarios, this may not be your best bet.

But don’t write it off before looking at the API, which has numerous functions including overlays, touch interactions, and event handling.

**Takeaways** : This library aims to provide a performance-first, React-centric extendable map engine without waiting for the large overheads of Google Maps to load.

With that in mind, the amount of functionality packed into this library is very impressive. However, I don’t think it should be used to power a fully-fledged map application.

So if your project calls for performant, free, open source software, this library fits your needs.

### Comparison overview

| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| | react-map-gl | Google Map React | React-mapbox-gl | React-Leaflet | react-geo | Pigeon Maps |
| Issues | 85 | 54 | 113 | 12 | 16 | 21 |
| Size (KB) | 216.8 | 12.6 | 15.3 | 7.1 | ?? | 7.0 |
| Map Solution | [MapBox](https://www.mapbox.com/) | [Google Maps](https://developers.google.com/maps/documentation) | [MapBox](https://www.mapbox.com/) | Provider Agnostic | [OpenLayers](https://openlayers.org/) | [OpenStreetMap](https://wiki.openstreetmap.org/wiki/Main_Page) |
| Costs | Pay per use | Pay per use | Pay per use | Free / Pay per use | Free | Free |
| Documentation | Great | Limited | Great | Good | Good | Limited |

### Conclusion

Each of these libraries brings their own set of pros and cons, which you’ll need to take into consideration when choosing the right library for a specific project.

The library that you use should really be project-dependent. This could vary on budget, functionality, customizations, and licensing.

A developer working on a project with a limited budget might consider a free solution, whereas someone doing a project built upon a free solution that has reached its limits may now consider migrating to a more feature-rich commercial solution.

* * * 
## Full visibility into production React apps 

Debugging React applications can be difficult, especially when users experience issues that are difficult to reproduce. If you’re interested in monitoring and tracking Redux state, automatically surfacing JavaScript errors, and tracking slow network requests and component load time, [try LogRocket.](https://www2.logrocket.com/react-performance-monitoring)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/eq752g8qhbffxt3hp9t4.png)

[LogRocket](https://www2.logrocket.com/react-performance-monitoring) is like a DVR for web apps, recording literally everything that happens on your React app. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. LogRocket also monitors your app's performance, reporting with metrics like client CPU load, client memory usage, and more.

The LogRocket Redux middleware package adds an extra layer of visibility into your user sessions. LogRocket logs all actions and state from your Redux stores.

Modernize how you debug your React apps — [start monitoring for free.](https://www2.logrocket.com/react-performance-monitoring)
* * *

The post [React map library comparison](https://blog.logrocket.com/react-map-library-comparison/) appeared first on [LogRocket Blog](https://blog.logrocket.com).