okfn / timemapper

Create and share elegant timelines and timemaps fast
http://timemapper.okfnlabs.org/
MIT License
274 stars 60 forks source link

Support of different map base layers instead of just openstreetmap #61

Open 4tikhonov opened 10 years ago

4tikhonov commented 10 years ago

Is it possible to use in timemapper other map solutions than Leaflet, for example Google Maps?

[Separate issue e.g. #60 - If it's possible to adjust to render directly from the source (JSON, CSV, etc), it can be quite useful for developers to show landscapes, routes, etc.]

rufuspollock commented 10 years ago

What would be the reason for having google maps rather than leaflet? It would be possible but point of view simplicity it would be nicer to keep a single map backend. (Showing different layers is possible if that is needed).

4tikhonov commented 10 years ago

For example, to show war battles with historical boundaries.

rufuspollock commented 10 years ago

OK, so you'd like a custom layers - got you. I note that the map is the Recline map view running off Leaflet so anything leaflet does we'd be able to support and leaflet definitely supports custom layers afaik.

4tikhonov commented 10 years ago

Yes, exactly correct! And I want to make render the right column (which is map at the moment) with custom layers from data file.

rufuspollock commented 10 years ago

OK, this is starting to get quite complex ;-) Are you a coder btw?

4tikhonov commented 10 years ago

Yes, developer. This is why we need all this complex stuff, by the way http://www.slideshare.net/vty/bridging-research-and-collections

rufuspollock commented 10 years ago

@4tikhonov ok - this would be too hard to implement. I'm just implementing custom config for each view and this could be part of it. Would you be up for implementing if i provide guidance?

4tikhonov commented 10 years ago

Yes, please provide the guide and I'll check what I can do.

rufuspollock commented 10 years ago

so the map section is the Recline map view which is a thin wrapper around leaflet: https://github.com/okfn/recline/blob/master/src/view.map.js

Roughly I think we need to

  1. Check out how leaflet lets you configure layers - see e.g. http://leafletjs.com/examples/layers-control.html
  2. Work out how we'd add this into recline map view
  3. Work out how we'd serialize the config info about the layers (can we serialize into json??)
  4. Store that config info in tmconfig item and use in frontend - see https://github.com/okfn/timemapper#overview-for-developers for more about our setup here ...

@4tikhonov does this make sense?

rufuspollock commented 10 years ago

@4tikhonov just wanted to check if the above roadmap made sense (also if the architecture overview made sense)

rufuspollock commented 10 years ago

Here's what you'd need to change in recline: https://github.com/okfn/recline/blob/master/src/view.map.js#L436

To use google maps as the base layer see http://matchingnotes.com/using-google-map-tiles-with-leaflet

Proper way is to put a proper patch into recline but right now we could possibly monkey-patch here ...

betacoder commented 10 years ago

HI @rgrp after the comment has be made , i contacted James and found out replacing the tile would display Google Maps instead of Openmaps .

Here is the fix for that

  1. Track the Line 436 from - https://github.com/okfn/recline/blob/master/src/view.map.js#L436
  2. Replace the Tile with

var mapUrl = " https://mts0.google.com/vt/lyrs=m@209000000&hl=en&src=app&x={x}&y={y}&z={z}&s={s}";

This should work charmingly :+1:

I suggest @rgrp to add a comment line so users could uncomment, incase they need Google maps.

Thanks to Jamescroft from Matching notes and Precisely to @rgrp and @okfn Labs for the wonderful Timemapper.

rufuspollock commented 10 years ago

@betacoder this is awesome - thanks for reporting. We should probably make this a config option. In the mean time this is a very nice "hack".