Software

Polylines are an efficient way to represent line geometries. You provide a geometry, and out comes a scrambled string of letters and numbers that encodes the geometry in just a few characters. Polylines are helpful when you want to efficiently transfer geometry information between services. The Mapbox Static Images API, for example, can overlay complex geometries from Polylines, which wouldn’t be possible otherwise because the request-URL length is limited.

Placemark has released a new Polyline JavaScript library, allowing developers to encode or decode coordinate arrays and GeoJSON objects. It does pretty much the same as existing Polyline utilities from Mapbox or Google. Still, Placemark’s solution is a modernised implementation that includes TypeScript types and a neat autogenerated documentation site; it supports ESM and UMD imports and standardises longitude-latitude order.

A New Major Version for Leaflet Is in the Works; Catching up With Latest Technological Developments

Leaflet was one of these libraries that I thought were done. While there have been constant updates and new releases throughout the years, there were rarely any massive, ground-breaking additions. Leaflet is built perfectly against its small, well-defined scope. Huge changes just weren’t necessary.

Even great software is never done because it needs to keep up with the latest technological developments. And so development of a new major release for Leaflet was announced as part of the 1.9 release notes. The work for the next major version catches up with recent developments in the browser market, the JavaScript landscape and compiler tooling:

  • Dropping support for Internet Explorer.
    This has been a long time coming, but now that Internet Explorer is officially end-of-life, it’s time to say goodbye. Going forward, Leaflet will move to an evergreen strategy that targets browsers like Firefox, Chrome, Edge and Safari.
  • Embracing modern JavaScript.
    To maintain backwards compatibility, Leaflet is written entirely in ES5, a version of JavaScript supported by legacy browsers. So we have not been able to make use of many great JavaScript features (e.g. standardized classes, instead having to rely on our own implementation). By adopting a more modern version of the ECMAScript standard, we can start working towards aligning Leaflet with what is expected from a modern JavaScript library.
  • Standardized modules.
    When we released Leaflet v1, the landscape in the JavaScript world was very different and full of competing module standards such as CommonJS, AMD and UMD. Today, ECMAScript modules have become the clear way forward to unite the JavaScript ecosystem under one banner. Moving forward, Leaflet will only be distributed in a single standardized module system, greatly reducing complexity of our distributed code.
  • Removing the Leaflet global.
    As a developer using Leaflet, the capital letter L is probably intimately familiar to you. This is the Leaflet global where all of Leaflet’s functionality lives. To allow compiler tooling to better eliminate dead-code through a process called tree-shaking, we are removing this global variable. To preserve backwards compatibility with older plugins, we will provide a shim that can be imported manually that will restore this functionality.

There’s no release date, not even an estimate, and maintenance of the 1.x branch will continue in the meantime.

Felt have hired Erica Fischer and are reviving development of Tippecanoe, which hasn’t seen many updates in the last couple of years. The last release was on over two years ago.

Tippecanoe is an essential tool for geospatial-data providers. It creates vector tile sets from various geospatial formats and optimises the data for visualisation purposes, so the resulting maps allow viewers to understand the density of a data set without clustering or excluding data.

Speaking in the Felt blog, Erica hints at what might be next in store for Tippecanoe:

The special challenge of Tippecanoe at Felt is that it is being applied to user uploads with no opportunity for manual configuration, so it has to be able to make efficient, faithful, good-looking tiles without being given any hints about what kind of data it is tiling. I already know that it doesn’t currently do very well at low zoom levels with topographic contours, or with gridded data represented as individual polygons, or with continuous urban parcel polygons, or with branching systems of rivers, and I’m sure the uploads will also soon reveal other usage patterns that need to be detected and given some special treatment.

Felt will maintain Tippecanoe in a fork; Brandon Liu, of Protomaps fame, has also been working on another fork — and they are planning to unify development going forward.

Excellent open-source citizenship all around.

MapServer 8.0 Adds OGC APIs and FlatGeobuf Data Sources

MapServer 8.0 was announced last night; adding, amongst other improvements, two features that stand out:

MapServer, together with PostGIS, was one of the first open-source GIS libraries I used as a Geography student some 20 years ago. If my memory isn’t too clouded, MapServer was among the first open-source products to implement OGC standards. Fantastic news that it’s still under active development and keeping up with the latest developments in the industry.

OpenLayers 7.0.0 Adds More WebGL Renderers and Drops Internet Explorer

Just in time for FOSS4G next week and the annual OpenLayers Feature Frenzy, the OpenLayers team has released 7.0.0, a new major version. Over 90 pull requests went into this release, but two changes stand out: Internet Explorer is no longer supported. And WebGL rendering has been extended to support lines and polygons alongside points.

A renderer converts geo-data into data structures that browsers can render. In the past, OpenLayers has primarily relied on the Canvas API to render vector data. Compared to Canvas, WebGL is considered more performant, especially when visualising complex geometries or large datasets.

Adding more WebGL-rendering capabilities to OpenLayers has been an ongoing effort in the last few years, and there’s more to come:

The rendering API is still low level and experimental. Future releases will include a higher level styling API.

Technically this is a breaking change, but upgrading should be straightforward, according to the release notes:

[W]e changed the signature for a number of methods on a helper class that had been marked as part of the API in 6.x releases. While this is technically a breaking change, it is unlikely that applications were using this helper class, so upgrades should be straightforward.

Thematic-Mapping Library Bertin.js Reaches 1.0 Milestone

I somehow missed this: Bertin.js has reached a significant milestone with its 1.0 release.

Screenshot of a map created with Bertin.js. It shows the whole world in the Interrupted Goode Homolosine projection, each continent is depicted in a different colour.
A world map produced with Bertin.js. Screenshot from @neocartocnrs.

Bertin.js is a JavaScript library that simplifies creating static thematic maps in SVG, primarily for print, online publications or presentations. You can certainly add a level of interactivity, but Bertin.js isn’t designed to replace, or compete with, interactive-mapping libraries like Leaflet, OpenLayers, or MaplibreGL.

Bertin.js provides a comprehensive API to make thematic maps using classification, cartograms and tooling to add map components, such as titles, footers, legends, or graticules. It is a wrapper around D3’s powerful mapping capabilities, providing reasonable defaults so you can focus on designing your map and don’t have sweat intricate details such as creating a legend and specifying individual pixel coordinates to perfectly align symbols and labels.

The examples are impressive.

Following last week’s post explaining the tile-addressing schema in PMTiles version 3, Brandon Liu now discusses its compression approach reducing the disk space required to store a global tile dataset to only 91.6 MB.

Update: Brandon clarified on Twitter, the 91.6 MB mentioned above only holds the data required to map Z,X,Y coordinates to the corresponding Tile ID. The actual global map data set is 80GB. (15 August 2022)

MapLibre 2.2.0 introduces 3D Terrain Maps

A new version of MapLibre was released just yesterday. Release 2.2.0 is a minor version in semantic-versioning speak, but it adds a major feature: 3D terrain maps, enabling developers to visualise the topography of land surfaces in interactive maps on the Web.

Mapbox introduced a similar feature to Mapbox GL 2.0.0, the first of the library’s releases after moving away from an open-source license. MapLibre is a fork of Mapbox GL that was created to preserve and continue the work under an open-source license. Thanks to the efforts of MapLibre maintainers, developers can now build interactive 3D maps for the Web using open-source technology.

I’ve played around with a small example based on an example by Oliver Wipfli, and the results look really slick. Some minor issues still exist, for example, the hill shade disappearing when you tilt the map close to a horizontal view.

MapLibre's 3D terrain in action; also demonstrating smaller issues when tilting the map close to a horizontal view.

It’s great to see the project under such active development. Mapbox has paved the way for modern web mapping with vector tiles, but it’s good to have more competition in the space — even better when the competition is open-source.

Django 4.1: New Features for Handling Geometries

Django 4.1 brings two new features for handling geographic geometries; allowing developers to create valid and canonical geometries more easily:

  • GEOSGeometry.make_valid() returns a valid representation of a geometry. Unless the geometry is already valid, then the geometry is returned without changes. The function is very similar to ST_MakeValid in PostGIS.
  • GEOSGeometry.normalize() returns the canonical, or standardised, representation of a geometry. The method now accepts the optional clone keyword indicating that the normalisation must not change the geometry and instead return a new geometry object.

Additionally, support for GDAL 2.1 and PostGIS 2.4 has been removed, and the Django Admin’s OpenLayersWidget is now deprecated.

Check the release notes for all other changes in Django 4.1.

Whether you’re just beginning with Leaflet or you’ve been around when Leaflet 0.7 was the current release, this collection of more than sixty Leaflet examples is a valuable resource for anyone. There are basic examples like setting up a Leaflet map or adding a marker, solutions to more complex problems like fitting bounds with padding, and advanced concepts such as overlaying images or searching across layers.

A new release of the web-mapping library OpenLayers is out. v6.15 includes, among other things, performance improvements, enhanced styling options for symbols, and bug fixes.

mbtiles-s3-server is a new Python library, developed by Michal Charemza, which reads vector geo-data from an MBTiles file stored in S3 and serves it as vector tiles. The library leverages range requests to query an SQLite database in S3.

Very much in line with advancements in file-based, cloud-optimised data storage we’ve been seeing in the last couple of years.

Google Maps Introduces Data-Driven Styling, the Cumbersome and Inaccurate Way to Make a Map

The Google Maps API was never an obvious choice for building advanced cartographic data products. It was always something local businesses use to put a map on their website showing where their shops are located.

Google Maps has now introduced data-driven styling, addressing a new audience outside local businesses. Data-driven styling of Google-maintained administrative boundaries that is. Google maintains and provides a data set of boundaries at varying administrative levels and allows developers to join their thematic data to create choropleth maps.

Looking at the documentation, linking your own data to Google’s boundaries dataset isn’t straightforward. To match the records from your dataset to the features from Google’s boundary dataset, you need to find the corresponding place ID from the Region Lookup API. If you have a hundred records, you need to do a hundred location lookups via the API before your map can be fully rendered. Unless you’re already keeping Google’s place ID in your data, which we all do, don’t we?

What’s the point of this approach is over loading and styling a GeoJSON layer, which has been supported by the Google Maps API before? Sure, you don’t have to maintain an administrative-boundaries dataset. But if the geometry and thematic data come from different sources, can we be sure that both represent the same underlying geographic area. Does this number of Covid cases aggregated by council assume precisely the same boundaries Google provides? We can’t know for sure, and the resulting maps might be unintentional lies.

And obvious use cases for maps based on administrative boundaries include election data, demographic information, or the number of COVID cases within a council. The people producing such data sets will likely maintain or have access to official and accurate boundary data sets. They have no reason to use Google Maps.

Google Maps data-driven styling isn’t a well-designed API of a product that solves a real problem. It’s a marketing stunt.

Mapbox GL JS 2.9.0 Adds Globe Projection

Mapbox GL JS’ latest release (v2.9.0) adds a new globe projection, which enables presenting web maps in a way that allows viewers to interact with geographic data much like you would interact with a physical globe.

A globe rendered with Mapboc GL JS, showing Africa in the center.
Background tiles: © Mapbox. Map data: © OpenStreetMap contributors.

From the release notes:

This new projection displays the map as a 3d globe and can be enabled by either passing projection: globe to the map constructor or by calling map.setProjection('globe'). All layers are supported by globe except for Custom Layers and Sky.

The globe projection is a continuation from custom projections, which were introduced a couple of months ago and, for the first time, allowed creating interactive web maps using projections other than Web Mercator. While custom projections were ideal to present data restricted to countries or continents and without the hefty distortions that come with Web Mercator, the globe projection allows to do the same but on a global scale; ideal to present global data sets like visualisations of climate change.

Update: Mapbox has published a blog post with very nice-looking examples: A new way to experience the world.