Couple questions about Map Tile Servers

58 views
Skip to first unread message

Gary B

unread,
Dec 14, 2019, 2:41:00 PM12/14/19
to openmap-users
My company just purchased map tilesets from openmaptiles.com

I'm currently running that company's docker container in order to serve the tiles, and a few things are happening that are causing my current openmap configuration some heartache:

a) The "hillshades" tiles are transmitted with "Content-encoding: gzip" and filename has a ".png" suffix. These aren't rendering; when I go look in the cache directory, the .png files are actually gzipped. For example:

chunky@mills:/tmp/mapcache/Hillshades$ file ./2/2/2.png
./2/2/2.png: gzip compressed data, from Unix
chunky@mills
:/tmp/mapcache/Hillshades$ gzip -cd ./2/2/2.png | file -
/dev/stdin: PNG image data, 256 x 256, 8-bit colormap, non-interlaced

The initialisation code in my class that extends MapTileFactory is:

        Properties tileProps = new Properties();
        tileProps
.put("rootDir", "http://myserver/data/hillshades/{z}/{x}/{y}.png");
        tileProps
.put("cacheSize", 12000);
       
File cacheDir = new File("mapCache/Hillshades/");
        tileProps
.put("localCacheRootDir", cacheDir.getAbsolutePath());
       
       
ServerMapTileFactory serverMapTileFactory = new ServerMapTileFactory();
        serverMapTileFactory
.setProperties(tileProps);
       
this.tileFactory = serverMapTileFactory;

b) I'm currently using the raster variant of the OSM tile URLs, but upstream they're really PBF vector files, and the preferred clientside web renderer appears to actually be using a WebGL vector render. Is there a right combination of pieces to get openmap to render the vector variant, pulling the data from the server?
Looking at the options their container offers, I see this set of options in the "GL Style" vector metadata [called "style.json"], that look to be what's actually needed to grab the data:

sources url: http://myserver/data/v3.json
sprite
: http://myserver/styles/dark-matter/sprite
glyphs
: http://myserver/fonts/{fontstack}/{range}.pbf

... but obviously it's style.json, so it also contains all the actual style data. Even better than my previous question would just be a way to point openmap to this GLStyle json file and have it magically do everything therein

Cheers
Gary

Don Dietrick

unread,
Dec 16, 2019, 12:05:34 PM12/16/19
to Gary B, openmap-users
Hi Gary,

For a), you could probably just get it to work by extending the ServerMapTileFactory and overriding the getImageBytes(…) method, so it uses a GZIPInputStream to decode the compressed input stream into the imageBytes array that’s returned.  That’s not something people did when I wrote that code, but that’s a nice upgrade for the OpenMap version, too, I’ll put it on the list.

For b), I started working creating code to render vector map files on the client, that code is in the v6.0 branch under the com.bbn.openmap.dataAccess.mapTile.mb package.  That code reads a css file to figure out how to render everything.  It’s not quite complete, I still have to get text and symbols working.  It was developed against the first set of data that the openmaptiles project released, and I quickly tried it against their subsequent releases and it didn’t work on those - I wonder if those are gzipped now, too, though.  I’ll have to try that out.  That package depends on a couple of other projects that maven will download for you, if you want to take a look at it.

Hope this helps,

Don

--
You received this message because you are subscribed to the Google Groups "openmap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openmap-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openmap-users/4626bd03-f0e0-43c5-abf2-4e2d5602cf0c%40googlegroups.com.

Gary B

unread,
Dec 17, 2019, 10:47:43 AM12/17/19
to openmap-users
Hey Don,

That makes sense.

I had separately tried that package in v6 and run into problems, but the fact you developed it with openmaptiles explains the issue; the mbtiles spec specifically calls out querying a table/view called "tiles": https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md

The SQL currently in openmap's vector mbtiles code joins together "image" and "map", which is specific to how openmaptiles build their databases. Openmaptiles does include a view called "tiles" that matches the spec, but the code currently ignores it.

Of note, mbtiles actually include an extra header in their raw data that the "tiles" view gets rids of; I'd suggest just seeing if changing your SQL to only target "tiles" fixes your issue

Cheers
Gary
To unsubscribe from this group and stop receiving emails from it, send an email to openma...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages