PMTiles as a data source for the JOSM MapWithAI plugin

Posted by vorpalblade on 9/14/2023

A few weeks ago, I wrote a plugin for PMTiles for JOSM. PMTiles is a web-first tile storage format which allows the provider to have a single file with all the tiles they want to share. Users can then make direct requests using HTTP Range Requests to get just the data they want. With this, other OSM users have discovered that they can run a tile server for <2 USD/month.

As of Aug 28, 2023, the JOSM MapWithAI plugin now supports PMTiles and Mapbox Vector Tiles as data sources. Please note that no tag transforms are occurring, so if you do use the data, please use the replacement tags feature of the plugin. With that said, it is theoretically possible for a pmtiles file to give us the mappings; the specification has a JSON metadata field which can have arbitrary key value mappings.

Anyway, here are some known datasets to test out this functionality (I only tested the overture-pois.pmtiles file):

As a reminder, there is a reason why the overture data has not been imported into OSM, mainly quality concerns. So if you do use it, ensure that whatever it is you are adding actually exists (for POIs) or is geometrically correct (for buildings/roads).

I’m currently looking at what it would take to add them to the default sources.json for the MapWithAI plugin along with known tag mappings, so that users don’t have to follow these steps to add them:

  1. Install/update the JOSM MapWithAI plugin. You may also need to install the PMTiles plugin if it was not automatically installed when you updated the MapWithAI plugin.
  2. Open JOSM Preferences
  3. Go to the MapWithAI sub preference panel
  4. In the Servers tab, there is a Selected entries: section. To the right of that section, there is a + button for adding new entries.
  5. Enter the appropriate url in the Enter Service URL box and change the source type (What is the type of this source?) to PMTILES. You can call the source whatever you like, but I would recommend using something descriptive (such as “Overture Land”, or “Overture POIs”).
  6. Click OK
  7. Download an area from OSM
  8. Data -> MapWithAI -> the name you entered in step 5
  9. Look at the newly added data. You can add it as normal with the MapWithAI plugin. I do not recommend doing this at this time, since the tags have not been mapped to OSM.

If, instead, you just want to browse the overture data, you can install the PMTiles plugin by itself. Once you have done that, you can do the following:

  1. File -> Open Location
  2. Enter the PMTiles URL that you want to browse
  3. Hit enter
  4. (Optional) If you find an area where you want to view the properties of an arbitrary object, there is an advanced option to convert the PMTiles layer to a standard OSM data layer. Please don’t upload the generated layer.

If you find a bug or something is not working as expected, you can file tickets on https://josm.openstreetmap.de/ . Please use the Report bug action when doing so, and change the component to Plugin pmtiles or Plugin mapwithai, depending upon which plugin is exhibiting the issue.