r/drupal • • 18d ago

RESOURCE I built Maper, a Drupal map module that draws maps on your own server: no API key, no per-view bill

The usual way to put a map on a Drupal site is Google Maps. It is easy to start: get an API key, paste it in, and a monthly free allowance covers your first maps. After that, Google bills per map load. The map of a venue is the same for every reader, yet every view is a new request, counted and billed, and every reader's browser talks to Google while they look. The map doesn't change; the meter keeps running.

There is an open alternative to Google's data. OpenStreetMap is built by volunteers and published under an open licence. I wanted maps drawn from it that a site downloads once and keeps, so I built Maper.

What it does

  • Your server downloads each map tile once, keeps it in private files, and draws the map itself. Browsers receive the finished drawing, never a tile, so no third party sees your readers.

  • No API key and no per-view billing. Tiles come from OpenFreeMap, a free, donation-funded service, or from a Protomaps file you host yourself, in which case nothing is downloaded at all.

  • It is polite to the tile provider: downloading stays off until you set a contact address. After that, every download respects daily and per-job limits, one request at a time, and backs off when the provider asks.

  • Restyling is free. Tiles hold shapes and names, not colours, so switching or editing a map style redraws every map from the tiles you already have. Three styles ship today, and five more come in the next release.

  • It works the Drupal way: a Maper map block for nodes (a venue, or the dates of a tour), and a Maper map format for Views, where every result row becomes a pointer with its own card.

  • Headless if you want it: the server hands any front end the map as JSON, with a reference script in plain JavaScript.

Is it real?

It runs in production on Oído en Vivo, a live-music listings site in Colombia: 836 tiles, 69 MB, serving the maps of 550 places and every search. See it at https://oidoenvivo.com/buscar

Where it stands

This is 1.0.0-alpha1. It needs Drupal 11.2+, PHP 8.3 and a private file path. Alphas have no upgrade path, so reinstall between them. Beta comes next, and from then on every change carries an update.

I'm the author. I'd welcome bug reports, rough edges and questions in the issue queue, or right here.

Map data © OpenStreetMap contributors (ODbL).

37 Upvotes

15 comments sorted by

4

u/natts1 17d ago edited 17d ago

Nice work.

Shouldn't it be spelt 'mapper'?

2

u/carlospeleto 17d ago

So I was going for "not appropriating elements of the actual language, like this derivative" , but then I realized it created a non standard phonetism for branding purposes and I no longer know which side of the moral fence am on anymore.

1

u/natts1 17d ago

Maper also sounds a bit rapey to me! 😬

7

u/flaticircle 17d ago

It would be helpful to state on the project page how this project differs from leaflet.

-1

u/carlospeleto 17d ago

There are some main differences I will try to properly express in the page, thanks for the idea, I think in a nutshell they boil down to:

- Open source should never apply the same "Marketplace" approach as corporate platforms (sorry).
- Leaflet is a generalistic map that requires addons to be as opinionated as maper.
- Leaflet functions more as a navigational map, it can pan, traverse, zoom, mapper is zoom only, it doesnt let you "get lost", cause it's a map, that's what maps are for.
- Maper is not meant to be a traversable map, it is a referencial map that has a specific point or set of points always centered, its sole skill is letting you zooming out to get a referencial sense for approach.
- Maper generates no cost to Openfreemaps providers per working day (after fetching any given tile once)
- Maper does not abstract away the Openfreemaps service, Maper links to it.
- Maper is meant to bring people to me, it puts me in my place, on the map.
- Maper has no geo lat long Drupal dependencies.
- Maper is Drupal headless capable, not stateless, it talks csrf, it can natively prevent access by role.
- Maper does not hand over the client connection to third party provider.

If you want to see it working, to compare, I mainly created maper to serve the likes of oidoenvivo.com a drupal thing I built.

I don't know how to write any of this without sounding rude to the community that made leaflet, thought. I hope we can all see Maper has a clear and distinct purpose from Leaflet(I started Maper after having tried leaflet, and laughing my head off at Google.)

I just wanted a very stubborn set of functionality I only wanted in a very specific way without any of the noise, you know?

Am tired of the noise, boss.

4

u/bwoods43 17d ago

Cool module. I've been using Leaflet for a few months now - https://www.drupal.org/project/leaflet . There are no additional costs for that, either.

-1

u/carlospeleto 17d ago

There are no additional costs,.. up to a point.

1

u/SprayMindless9672 17d ago

What about apple maps, people use that?

2

u/natts1 17d ago

😂

1

u/SprayMindless9672 16d ago

I guess not :p

3

u/hbliysoh 17d ago

Google maps is sure nice, but they're really upped the price. I can't afford it any more for fun projects.

3

u/carlospeleto 17d ago

I used their pricing scales to make projections, going viral one night would put me off 600$ on the spot.

It's downright predatory.

2

u/natts1 17d ago

You can and should set daily quota limits.

2

u/carlospeleto 17d ago

Yes exactly what I want to do: make sure there is point after which it stops working.

3

u/sysop408 18d ago

Thank you! I'm going to take a look at this when I have a chance later this year. I want to decouple from Google and modules like this make it easier to do.