1

EDIT: I later realized that, instead of creating multiple 256 x 256 tiles, I could just create a single image to overlay on the entire map. However, I'd still like to know if there are better ways to do the below.

I'm trying to create OpenStreetMap style "slippy" tiles (but mine are equirectangular, not Mercator projection) on the fly from a SHP file. These GRASS commands work:


# restrict the region to the slippy tile I want and set the rows/cols to
# create a 256 x 256 map tile

g.region n=41 s=40 w=-105 e=-104 rows=256 cols=256

# convert my existing vector map (which came from a SHP file) to a raster map
# Note: I reuse/overwrite 'temp' since I don't want to create dozens on
# unnecessary raster maps when I run commands like these several times

v.to.rast --overwrite input=ne_10m_time_zones output=temp use=cat

# convert the result raster map to a PNG file
r.out.gdal --overwrite input=temp output=somefile.png format=PNG

but I'm wondering if there's a better way. In particular, I'm wondering if this is even the right approach. Note that gdal_rasterize will do this from the command line but is much slower. In my approach, I only open the grass74 shell once and keep it open, which might be improving my time.

I know the standard method is to pre-create map tiles, but I'm interested in the on-the-fly methods as well.

  • Standard method for rasterizing vector data is probably to use server like Mapnik, GeoServer of MapServer for that. They can all do that on-the-fly and also without tiling but you may feel that installing a map server is too heavy for your needs. – user30184 May 6 at 7:17
  • See for example gis.stackexchange.com/a/298878/687 – markusN May 6 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.