0

In my Meteor/Cordova/famo.us App I need a map that can be rotated with two fingers, zoomed in and out and (ideally) the names (street, city etc.) should stay horizontally aligned. The reason is that I haven't found a (free) map like leaflet.js, Google Maps etc. that can rotate in JS. Google Maps SDK for Android and iOS respectively can do this, but the corresponding plugin (plugin.google.maps) led to trouble with famo.us.

The rotation could be done with a famo.us Surface, and I've been told that in leaflet one could pull separately the map tiles and the names (vector/jpeg?).

I apprechiate your help.

user3819370
  • 513
  • 1
  • 6
  • 15

1 Answers1

1

Map rotation isn't possible in Leaflet. Read this answer: https://stackoverflow.com/a/22938733/2019281. However, it is possible in openlayers but it would also rotate the labels since they are embedded in the maptiles. See this example: http://openlayers.org/en/master/examples/rotation.html. You could use a tilelayer without labels and add create your own separate layer with vectorlabels and counterrotate those. This would be a very complex solution and i guess will put an enormous strain on your performance since you're talking about a mobile solution. I would rethink the concept.

Community
  • 1
  • 1
iH8
  • 27,722
  • 4
  • 67
  • 76
  • Thx for the fast and accurate answer. It's a dilemma, famo.us is the better framework, but the native Google SDKs got the better maps. I also think the vector solution is too inconvenient. As for Openlayers: I've seen this example before but didn't take a closer look. So can one set an arbitrary angle like view.setRotation(angle) or is this just for rotating with the mouse? So maybe if input of angles would be possible then this solution would fit best because for my application the (direction of the) labels aren't that important. – user3819370 Dec 09 '14 at 18:10
  • I just took a look at the docs and apparently it is possible to set the rotation via map.getView().getView2D().setRotation so I will mark this as the correct answer if nobody comes up with a better soultion the next days. – user3819370 Dec 09 '14 at 18:17