Thursday, March 4, 2010

Tile basemap through Views/GMaps module (Drupal)

To add a tiled basemap to a gmap created with views (and the gmaps) module:

1. First make sure that you have a gmap set up through views. This is a good tutorial: http://groups.drupal.org/node/19614

2. Next download the GMap Addons module, if you haven't already done so

3. Create a map tile structure using something like tilecache, mapcruncher, or ArcGIS (you can generate a map with the google maps scheme, just not sure where to get an xml that would adequately describe the scheme to ArcGIS)

4. Finally add a tile overlay macro within the style (GMap) configuration for this view. Use the following form:

[gmap |overlay=tile:http://host/tilesdirectory/{Z}/{X}/{Y}.png]

... notice you don't need to substitute anything for Z, X, or Y ... these correspond to folder numbering as generated with tilecache (or other tiling program) using the google maps scheme.

If you save the view you should now be able to see your basemap in a page generated by that view.

3 comments:

Unknown said...

I tried using mapcruncher, but the file format is quad-based, not file/folder based. ie 0123102.png instead of 000/000/000/001.png

is it possible to convert to the file/folder format like in tilecache?

Also, how does the drupal gmap addon module know where to place the image? Is that retrieved from the file/folder structure?

Unknown said...

Hi Mike,
I was having the same problem ... you should check out maptiler ... I ended up hijacking the arcgis javascript api so I could use tilecaches I had already created.

Unknown said...

@Mike, you should also check out this post: http://benmearns.blogspot.com/2010/03/tilecaching-mxdarcgis-server-to.html ... at the time was having some difficulty with maptiler naming, but have seen some discussion about that in their forum, and there seems to be a work around now