Has anyone done this with georeferenced images and the openlayers module? If so, can you provide some insight on how it's done?

example: http://geo.nls.uk/maps/towns/aberdeen/openlayers.html

CommentFileSizeAuthor
#24 maptiler-enabled.png151.68 KBKrisBulman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zzolo’s picture

Hi Kris,

I am not sure if our TMS layer will provide all the functionality you need, but you can always implement the layer_type and layer hooks to create what you need. Check out the examples provided in the module.

--
zzolo

tmcw’s picture

The TMS and OSM layer types are sufficient for this kind of application, but that's only a small part of the puzzle if you're looking to create new implementations. The OpenLayers module is only the display part of the equation. What's the other 90% is the tools to warp maps - there are new-age versions like Map Warper, Cartagen Knitter, and then there are somewhat old-age versions like using ArcGIS or QGIS with rubber-sheeting to make the composite images, and then using GeoServer or TileCache to serve the maps.

KrisBulman’s picture

I have the maps georeferenced and warped already, via QGIS and MapTiler/GDAL2tiles. I am able to get them to display in openlayers, a google maps implementation and in a KML file that displays on Google Earth... but NOT in the Drupal module.

Here are the existing examples: (not very warped)

http://96.45.180.228/lots_33-34_meachams/openlayers.html

http://96.45.180.228/lots_33-34_meachams/googlemaps.html

http://96.45.180.228/0682/doc.kml

I've attempted to use the KML feature in your module as a layer with the proper layer name, but no layer shows up. If I use tilecache, can anyone tell me what config options to use for an image overlay? I'm sure I can pull the data out of the existing examples to plug in there.. but I haven't had any luck creating a TMS layer pointing to something like http://96.45.180.228/tilecache-2.10/tilecache.cgi and when I do, the OpenLayers module seems to try to display the TMS layer as a base map, and not just an overlay.

We're attempting this at the University of Prince Edward Island, and have over 1000 historical maps scanned (some are even 10 meters long). We're very eager to get them displaying in our platforms of choice. (OpenLayers/Drupal)

tmcw’s picture

So the whole tiles-in-KML thing isn't really an option (and shouldn't be... it's kind of BS on a technical level). So this isn't working as a TMS layer? The TileCache URL that you noted seems to be down, so there's no way of testing against that.

It looks like MapWarper uses its own getTilesURL function for tiles, so it couldn't really be supported off-the-bat, but that may be incorrect - the getTilesURL function could be very similar to an existing scheme. Regardless, I'll look into it. And, yes, it's on the backlog to unify baselayers and overlays so that TMS layers can be used as overlays without messing around with code.

KrisBulman’s picture

I've updated the link to the tilecache cgi

http://96.45.180.228/tilecache-2.10/tilecache.cgi

The map I am testing is http://96.45.180.228/0682/openlayers.html

map info:
The PNG is http://96.45.180.228/0682/0682.png
The dimensions are: 6648px wide & 3981px high
from openlayers.html:
var mapBounds = new OpenLayers.Bounds( -63.3050189462, 46.347611308, -62.9175059265, 46.4602909498);
var mapMinZoom = 9;
var mapMaxZoom = 14;

The tilecache examples, state:


  [mario-8-4]
  type=ImageLayer
  file=/home/images/mario-8-4.gif
  bbox=0,0,5889,224
  filebounds=0,0,5889,224
  maxresolution=16

  [avalon]
  type=GDAL
  file=/home/images/avalon.jpg
  bbox=0,0,4000,1870

  [avalon]
  type=ImageLayer
  filebounds=-180,-88.759,180,88.759
  file=/home/images/avalon.jpg

  [basic]
  type=MapServerLayer
  layers=basic
  mapfile=/home/tilecache/basic.map
  debug=off
  description=VMap0-based vector layer, styled by Schuyler Erle.

  [DRG]
  type=WMSLayer
  layers=DRG
  url=http://terraservice.net/ogcmap.ashx?
  extension=jpeg
  debug=off

  [osm-map]
  type=MapnikLayer
  mapfile=/www/wms-c/osm.xml

  [massgis]
  type=ArcXML
  url=http://maps.massgis.state.ma.us/servlet/com.esri.esrimap.Esrimap?ServiceName=coq2005hsde_with_roads&ClientVersion=4.0
  layers=14
  bbox=218337.16112593404,889611.9317974453,248183.9359890727,914312.7109945256

I've modified my config to:

  [meachams]
  type=ImageLayer
  filebounds=-63.3050189462, 46.347611308, -62.9175059265, 46.4602909498
  file=/var/www/0682/0682.png
  maxresolution=5

the URL to my test map is: http://theming.bulman.ca/worldmap

In the module, I've set this up as a TMS layer, with http://96.45.180.228/tilecache-2.10/tilecache.cgi as the URL and layer name is "meachams"

Clearly, it's not working, although it does appear to be contacting my server as I see the IP in the viewer appear.. but the scale is way off, and it appears on the base layer, not as an overlay. I also don't think I set the bounds correctly.. any advice on setup on either end would help.

I've noted that the TMS layers as overlays is on the table as a future feature. Thanks for discussing this.

KrisBulman’s picture

I'm actually not even sure now if Tilecache will work for this implementation. I will look for their mailing list and research if any of the other suggested methods will work.

tmcw’s picture

Hey Kris, it looks like meachams isn't a layer on that TileCache server, only basic and NASA_JPL_WMS (here's a url where it lists those).

KrisBulman’s picture

Thanks, I'll play around with tilecache to see if I can get it to appear as a layer.

Problem being, I am not sure any of the supported examples will allow for a tiled overlay (like in my openlayers.html link) that's not just a whole map.. looks like just an imageoverlay that doesn't tile. I've posted a query to the mailing list.

KrisBulman’s picture

I'm also looking for other TMS options that will support this.

My original example was created with maptiler, and on their page http://www.maptiler.org/ it states:

"GDAL2tiles follows the OSGeo Tile Map Service (TMS) specification for publishing rendered maps as map tiles.

The TMS specification is implemented by several map clients (OpenLayers, WorldKit) and it is also supported by the TileCache project.

You can provide maps as pre-generated tiles using GDAL2tiles or use alternative ways of publishing with a combination of UNM MapServer (WMS), TileCache, or even GeoServer and GeoWebCache"

So I'm guessing I will have to get one of these working as a TMS implementation before we can go further here. Thanks for the help so far. If anyone else reading this has a working implementation that can be tested or can provide information on, please post it here.

tmcw’s picture

Kris: yeah, it's kind of bizarre; MapTiler clearly doesn't follow the WMS spec for its examples, and I can't find a single example of it actually following the spec. It uses the OpenLayers TMS layer type, but hacks it apart in a way that nothing will support the output layers natively.

KrisBulman’s picture

Not that this helps much, but mapstraction looks like it does GDAL2tiles

http://www.mapstraction.com/demo-tiles.php

KrisBulman’s picture

Please weigh in on the following todo's for maptiler

Mark Gray's TMS comment:
http://maptiler.uservoice.com/forums/10188-maptiler-todo/suggestions/125...

TMS tiles produced by MapTiler accessible trough WMS
http://maptiler.uservoice.com/forums/10188-maptiler-todo/suggestions/125...

Generate tiles from a WMS server supporting at least WGS84 (EPSG:4326)
http://maptiler.uservoice.com/forums/10188-maptiler-todo/suggestions/125...

tmcw’s picture

Okay, I'm 90% of the way to implementing a MapTiler layer type, and since I'm guessing there are a bunch of MapTiler layers out there, it would be a worthwhile addition to OpenLayers core. This obviously goes a bit against the idea of only supporting built-in OpenLayers layers, but I think that it's a decent addition...

KrisBulman’s picture

uhm.. amazing!!

zzolo’s picture

As far as putting it into core, as long as you think it can be supported in the long run and not hold development back (like the development of a third party codebase), then I'd say go for it.

zzolo’s picture

To clarify, I don't think either of these things apply, just stating what seems to be the policy we have had so far.

tmcw’s picture

Yeah - I agree. It's about 20 lines of simple javascript, so I don't think it'll be much of a maintenance task.

KrisBulman’s picture

will the changes be in dev?

tmcw’s picture

Category: support » task

Yeah - I think it'll be best to just push the changes in as soon as they're ready. It'll be a little bit - implementing another layer type got me thinking about the more-vital improvements + fixes to the system.

KrisBulman’s picture

Category: task » support

Cool, thanks for the update we'll keep tabs on it. In the meantime, I've installed a mapwarper instance and am about to test metacarta labs' map rectifier for ways to have our users warp images pre-maptiler.

Both produce WMS links, such as:

metacarta map rectifier WMS link: http://labs.metacarta.com/rectifier/wms.cgi?id=4009

mapwarper WMS link: http://warper.geothings.net/maps/wms/2469

but the plan is to obtain the the warped images and push them through maptiler for display through your module. :)

tmcw’s picture

Category: support » task
Status: Active » Fixed

Okay - MapTiler layer type committed to the 2.x branch: http://drupal.org/cvs?commit=360038

KrisBulman’s picture

I tried this out, works great!

Is it possible to show the overlay the layer by default instead of having to click the checkbox?

tmcw’s picture

It should be shown by default if you click 'Enabled' in the presets interface?

KrisBulman’s picture

FileSize
151.68 KB

I double checked that option (screenshot attached)

http://theming.bulman.ca/worldmap

I also noticed it was appearing as a baselayer and not an overlay in the settings window, even though the baselayer option is not checked in the actual layer settings. It does, however, display as an overlay on the map regardless of this.

tmcw’s picture

I think this is caused by the half-implemented system of inLayerSwitcher/enabled that resulted from another ticket...

KrisBulman’s picture

this one? http://drupal.org/node/710514

Would the fact that the maptiler overlay is displaying as a baselayer instead of an overlay in the preset settings be affecting it at all? (see screenshot in previous ticket)

KrisBulman’s picture

Should I open a new ticket on the maptiler overlay displaying as a baselayer instead of an overlay in the preset settings?

KrisBulman’s picture

Title: displaying warped historical map overlays » Maptiler layer support

From Klokan: (the creator of maptiler)

"I recommend to add into the Drupal OpenLayers code those two lines of
JavaScript code:

// Do not display any warning for missing tiles
OpenLayers.Util.onImageLoadError =
function(){this.src='http://www.openlayers.org/api/img/blank.gif';}
OpenLayers.Tile.Image.useBlankTile=false;

Better then http://www.openlayers.org/api/img/blank.gif would be to
use img/blank.gif on the local copy of OpenLayers. This will avoid
displaying of any artifacts for missing tiles in MapTiler layer."

tmcw’s picture

I've created a ticket here to handle that issue: http://drupal.org/node/787838

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

klokantech’s picture

Component: Layers » OL API
Issue summary: View changes

There is now a step by step tutorial for how to use MapTiler with Drupal made by Paul Vreede.

See attachment of the ticket:
https://www.drupal.org/node/2384877