Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Custom map orientation #531

Closed
artemp opened this Issue Oct 11, 2011 · 12 comments

Comments

Projects
None yet
7 participants
Owner

artemp commented Oct 11, 2011

To generate maps of i.e. the local zoo it is prefered not to have the north on the top but i.e. the main enterance.

This would mean the whole map is rotated x degrees (where x is userdefined), however labels should not be rotated.

Owner

artemp commented Oct 11, 2011

[artem] View transform allowing rotation would be a good start.

Owner

artemp commented Oct 11, 2011

[jharris2268] Replying to [comment:3 artem]:

View transform allowing rotation would be a good start.

I've had a go at this (see attached diff)

  • Map gains an orientation data member (plus getter & setter)
  • CoordTransform::forward and backward are modified to apply the specified rotation
  • The Map::view_transform() function passes the orientation angle to the CoordTransform
  • An additional Map::view_transform(int offset_x, int offset_y ) member is added
  • The renderer constructors call this new Map::view_transform instead of calling the constructor directly

This doesn't quite work however: the visible area is different to the specified map envelope. To fix this,
I've added a 'fix_angle_buffer' member to Map which sets the buffer_size to be large enough cover the visible area. Also, the orientation getter & setters convert between radians and degrees.

Two possible problems with this are:

  • CoordTransform::forward / backward gets called a lot, so making them more complicated may degrade performance in the majority of cases where no rotation is wanted. I'm not sure how this can be tested properly.
  • The orientation getter & setter convert between radians and degrees. This might not be too obvious

Also find attached a python demo, and example views of London zoo.

Hi Artemp,

I would love to see this feature implemented. Actually it is to only reason why we cannot use Mapnik at the moment. Where can I get your implementation? as I cannot not find the attachments you mentioned. We have an application with a fairly complex map so we can easily test whether this feature degrades performance a lot.

Thanks,
Pascal

Owner

artemp commented Nov 22, 2011

Hi Pascal,

Yes, this feature is on my TODO list, thanks for reminding! The message mentioning attachments is from [jharris2268] not me or am I missing something?

Artem

Thanks for the reply. I was a bit confused because the title said the you commented but I now see that it's indeed [jharris2268]. Any ideas on a time when this will be added?

Thanks again,
Pascal

Contributor

danpat commented Jun 26, 2012

I'll add my vote to this. I'm currently using ST_Transform with PostGIS to rotate coordinates before they enter mapnik, but everything would be a whole lot cleaner if I could simply set the rotation angle for the map as a property of <map>.

is this feature in the current version of mapnik (2.1)? how do i use it?

Owner

springmeyer commented Sep 14, 2012

Hi @lruminski - not, this is not yet in the mapnik code.

@flippmoke flippmoke closed this Apr 25, 2015

Was this actually implemented? Or just closed as "wont fix"?

As this seems to have been closed without a fix: does someone still have the orientation.diff patch file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment