Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If you had to use a projection other than 900913, how would you do it? #12

Open
migurski opened this issue May 14, 2012 · 2 comments
Open

Comments

@migurski
Copy link
Member

I'm experimenting with some alternate projections. I'm scratching my head a little trying to figure out the best way to make this work with modest maps, since the spherical mercator projection is hardcoded into the Map constructor. @tmcw or @shawnbot, if you were to add support for arbitrary projections, where would you do it? Would you have the Map object pick up the projection from the first layer it sees? Should it be possible to simply re-assign map.projection after an instance is created? I'm thinking it shouldn't and that picking up a projection from the first defined layer is the right way to go, and reassigning .projection is getting me some weird behaviors.

If you're curious, here's some sample code that I already know works on the server side in TileStache and I've verified that all the math is correct: https://gist.github.com/2691614

@tmcw
Copy link

tmcw commented May 18, 2012

So my ability to really say anything in this area is limited by not coming in contact with any non-Mercator maps recently or having a way to prop them up (can I just set up a quick layer in TileStache with an alt projection?)

So my best guess is this:

  • Projections will need to be one-per-map, and layer types will have to declare compatibility.
  • After Initialize map without layer #4 is done, you won't need a layer on map initialization
  • Thus it'll be like new MM.Map('blah').setProjection(projobj).addLayer(mylayer) (or less chainy with the same basic logic).

@migurski
Copy link
Member Author

Interesting, so it seems like projections should moved to the map from the layers, where they currently reside. This feels like a somewhat-overdue implication of the move to multiple layers, something that filled me with a degree of tension when I an early pass at layer support a while back.

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

No branches or pull requests

2 participants