jQueryGeo / geo

Small, fast & simple JavaScript mapping and geospatial API as a jQuery plugin
http://docs.jquerygeo.com
MIT License
423 stars 74 forks source link

Problem - maps with different projections on the same page #116

Open waynegm opened 11 years ago

waynegm commented 11 years ago

Hi,

I am a javascript/jquery beginner so please excuse me if I've missed something basic.

It doesn't seem possible to have maps with different projections on the same page. I suspect this is because geo.proj is in the global namespace and only one instance can exist for all geomap widgets on the page. Is that correct or is there a way to do this?

Thanks, Wayne

ryanttb commented 11 years ago

You are correct. Limiting the library to one projection at a time allows us to have projects but keep code small. There may be a case for a map-level projection option/override in the future but that's not yet designed. We will keep it in mind for future plans, though.

waynegm commented 11 years ago

Thanks. For the moment I can work around the issue. I'm trying to add jquery.geo as a plugin to Foswiki and the multiple maps were going to be on an example page. For the moment I can just split the examples across pages.

I've actually found that you can have a map with the default projection and one with a custom projection on the same page as long as the custom projection map is last. ...............(After some more investigation) Actually if I redefine "fromGeodeticPos" and "toGeodeticPos" each time I can have as many maps with different projections as I want on a page. It appears that changing these functions doesn't affect earlier maps on the page. This gives me the functionality I needed as is. The only caveat is at this stage I've only been experimenting with display, zoom and pan and not the other functionality of the plugin (drawing and feature display).