3

For some needs we need an OSM-style map displaying the area before the reservoir was constructed and thus displaying the historical shore line. There are some historical aerial photos (not provided by google, but licensed for any usage http://warfly.ru/?lat=55.797473&lon=49.047717&z=12 ) tiled on the manner of google maps, and some old maps stored as large jpeg images (http://xn--80aaaaaa8d3awdlhbbd.xn--p1ai/tatarstan/raritet/volga-kama-pojma-1950).

So, what we should consequently do to be able to produce such kind of online map?

  1. Setup own OSM instance (?) with clear postgis (?) (how?)
  2. Setup the map drawing client that is able to provide tiled WW2 aerial photos and jpeg maps bent to the map? How can we do that, which type of client supports it? If noone, but there are some open source that can be easyly programmed to make this support available with little coding (I hope for my Java coding skills), which opensource client is the most suitable for it?
  3. What is the best way to provide the isohypses information to make the map displaying the heights? Unfortunately they are not actually stored in osm and will not be available on our sources.
  4. What is the best way to make it available on the www. I know little about postgis, mapnik and tilecache usage, but I'm not sure that it is the best possible technologies stack.

The full guide in answer will be perfect, or even some ideas for some specific points asked are welcome! Thanks in advance!

3
  • 1
    Setting up the whole OSM set of tools feels as very heavy task if your final aim is not a clowdsourced edit environment. Are you goint to put users to digitize data from historical maps and images or do you plan to make that work yourself and show the results for the people?
    – user30184
    Sep 24, 2014 at 6:57
  • some group of trusted users would be allowed to digitize data, others will just see the result Sep 24, 2014 at 11:04
  • anyway, i need a set of free tools suitable for working with this kind of free content. Sep 24, 2014 at 11:05

2 Answers 2

3

It sounds like what you are really wanting is to be able to override specific tiles in a map.

I have implemented this with TileLayers in Google Maps in the past. Not sure how to do this with OSM, but there should be a tile request hook in your javascript that would allow you to point at a script to check a local cache before forwarding the request out to a tile provider.

in a php script:

$filename = $_GET["tile"];
if(!file_exists ( $filename ))
{
    $vars = explode('_', $filename);
    var_dump($vars);
    $x = $vars[2];
    $y = substr($vars[3],0, -4);
    $z = $vars[1];
    $url = "https://mts0.googleapis.com/vt?lyrs=m@253597357&src=apiv3&hl=en-US&x=".$x."&y=".$y."&z=".$z."&style=47,37%7Csmartmaps";
    echo $url;
    $cookie = tmpfile();
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $data = curl_exec($ch);
    curl_close($ch);
    echo $data;
    file_put_contents ( $filename , $data );
}
else
{
$type = 'image/jpeg';
header('Content-Type:'.$type);
header('Content-Length: ' . filesize($filename));
readfile($filename);
}

in your javascript:

var map;
function initialize() {
  var mapOptions = {
    zoom: 18,
    center: new google.maps.LatLng(47.6234693,-122.1826002)
  };
  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var bounds = {
    17: [[20969, 20970], [50657, 50658]],
    18: [[42099, 42106], [91531, 91533]],
    19: [[83878, 83881], [202631, 202634]],
    20: [[167757, 167763], [405263, 405269]]
  };

  var imageMapType = new google.maps.ImageMapType({
    getTileUrl: function(coord, zoom) {
      if (zoom < 17 || zoom > 20 ||
          bounds[zoom][0][0] > coord.x || coord.x > bounds[zoom][0][1] ||
          bounds[zoom][1][0] > coord.y || coord.y > bounds[zoom][1][1]) {
        return null;
      }
      return ['http://localhost/tiles/tile.php?tile=L2_', zoom, '_', coord.x, '_', coord.y, '.png'].join('');
    },
    tileSize: new google.maps.Size(256, 256)
  });

  map.overlayMapTypes.push(imageMapType);

}

google.maps.event.addDomListener(window, 'load', initialize);
1
  • Thanks a lot! So you consider web editor + additional tiles from the sources I need, that sounds good. Before I suggested there will be some desktop editor for that needs. In that case, when I have some plain jpeg image as an old map, I need to make a it be tiled somehow. Do you have any ideas how to do it? Sep 26, 2014 at 20:30
1
  1. To Setup own OSM instance with clear postgis, refer to this page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.