GCA Google maps with OpenStreetMap option
- Nilbog_Aus
- 650 or more caches found
- Posts: 102
- Joined: 12 June 06 7:48 pm
- Location: Wahroonga, NSW
- Contact:
GCA Google maps with OpenStreetMap option
I was playing with mapping layers at work (trust me it was more interesting than the coding I was supposed to be doing ) and I came across incorporating OSM maps into Google maps. http://wiki.openstreetmap.org/wiki/Usin ... n_web_site
So I wondered if it was something that could be added to the GCA Google maps?
I know the GCA developer are probably busy with the site move but I was hoping it could be something maybe added to the wish list.
So I wondered if it was something that could be added to the GCA Google maps?
I know the GCA developer are probably busy with the site move but I was hoping it could be something maybe added to the wish list.
- CraigRat
- 850 or more found!!!
- Posts: 7015
- Joined: 23 August 04 3:17 pm
- Twitter: CraigRat
- Facebook: http://facebook.com/CraigRat
- Location: Launceston, TAS
- Contact:
- Nilbog_Aus
- 650 or more caches found
- Posts: 102
- Joined: 12 June 06 7:48 pm
- Location: Wahroonga, NSW
- Contact:
Re: GCA Google maps with OpenStreetMap option
More playing with slippy maps on my part and I have figured out some javascript code to show OSM tiles with the Google Maps API.
http://users.tpg.com.au/brind1/tpgmap.htm is my current effort for something else I am working on. The address field on this link only updates the map when you click outside the address field. This makes more sense in the context of the project I wrote it for.
Having a quick look at the GCA code I hope it should just be a matter of adding my code snippet to the showmap functions in the GCA JavaScript.
Code: Select all
var copyOSM = new GCopyrightCollection("<a href=\"http://www.openstreetmap.org/\">© OpenStreetMap</a> (and) contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>");
copyOSM.addCopyright(new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, " "));
var tilesMapnik = new GTileLayer(copyOSM, 1, 17, { tileUrlTemplate: 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png' });
var tilesOsmarender = new GTileLayer(copyOSM, 1, 17, { tileUrlTemplate: 'http://tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png' });
var mapMapnik = new GMapType([tilesMapnik], G_NORMAL_MAP.getProjection(), "OSM");
var mapOsmarender = new GMapType([tilesOsmarender], G_NORMAL_MAP.getProjection(), "OSMtah");
map.addMapType(mapMapnik);
map.addMapType(mapOsmarender);
Having a quick look at the GCA code I hope it should just be a matter of adding my code snippet to the showmap functions in the GCA JavaScript.
- CraigRat
- 850 or more found!!!
- Posts: 7015
- Joined: 23 August 04 3:17 pm
- Twitter: CraigRat
- Facebook: http://facebook.com/CraigRat
- Location: Launceston, TAS
- Contact:
Re: GCA Google maps with OpenStreetMap option
Hey, thanks for that (I'd forgotten about this ... )
I'll have a play and see if it works!
I'll have a play and see if it works!
- CraigRat
- 850 or more found!!!
- Posts: 7015
- Joined: 23 August 04 3:17 pm
- Twitter: CraigRat
- Facebook: http://facebook.com/CraigRat
- Location: Launceston, TAS
- Contact:
Re: GCA Google maps with OpenStreetMap option
Seems to work. I've added it to the cachers gmaps and to the query gmap functions.
Thank you for your contribution (every bit helps!)
I've credited this change to you in the source and also in our SVN Repository.
Thank you for your contribution (every bit helps!)
I've credited this change to you in the source and also in our SVN Repository.
- caughtatwork
- Posts: 17015
- Joined: 17 May 04 12:11 pm
- Location: Melbourne
- Contact:
Re: GCA Google maps with OpenStreetMap option
Yay! Blame someone else
- Nilbog_Aus
- 650 or more caches found
- Posts: 102
- Joined: 12 June 06 7:48 pm
- Location: Wahroonga, NSW
- Contact:
Re: GCA Google maps with OpenStreetMap option
Wow that was quick. Thanks!
Don't worry I have found there is always enough blame to go around all the developers no matter how big the group.caughtatwork wrote:Yay! Blame someone else
- caughtatwork
- Posts: 17015
- Joined: 17 May 04 12:11 pm
- Location: Melbourne
- Contact:
Re: GCA Google maps with OpenStreetMap option
Actually, I think they're great.
Thank you very much for allowing us to steal your code.
What's the difference between OSM and OSMtah?
Thank you very much for allowing us to steal your code.
What's the difference between OSM and OSMtah?
- Nilbog_Aus
- 650 or more caches found
- Posts: 102
- Joined: 12 June 06 7:48 pm
- Location: Wahroonga, NSW
- Contact:
Re: GCA Google maps with OpenStreetMap option
I meant for OSM to stand for "Open Street Map". These map tiles are created weekly-ish on the open street map servers.
I meant for OSMtah to stand for "Open Street Map Tiles @ Home". These map tiles are created much more often based on each tiles usage. Although these map tiles are still served from a central server they are created by a distributed volunteer network, similar to SETI@Home or Folding@Home.
I tend to use both these two. I prefer the fonts and style of OSM but sometimes Tiles@Home is more up to date.
The great thing about OSM data is that it is open source. This means not only can anyone update the data behind the maps but anyone can generate maps off the data. This means cool things like Tiles@Home and opencyclemap are possible.
It's probably clear by now I'm a big fan of OSM. Hopefully having OSM maps on GCA will encorage people to update the OSM maps and make them even better.
I meant for OSMtah to stand for "Open Street Map Tiles @ Home". These map tiles are created much more often based on each tiles usage. Although these map tiles are still served from a central server they are created by a distributed volunteer network, similar to SETI@Home or Folding@Home.
I tend to use both these two. I prefer the fonts and style of OSM but sometimes Tiles@Home is more up to date.
The great thing about OSM data is that it is open source. This means not only can anyone update the data behind the maps but anyone can generate maps off the data. This means cool things like Tiles@Home and opencyclemap are possible.
It's probably clear by now I'm a big fan of OSM. Hopefully having OSM maps on GCA will encorage people to update the OSM maps and make them even better.
- Nilbog_Aus
- 650 or more caches found
- Posts: 102
- Joined: 12 June 06 7:48 pm
- Location: Wahroonga, NSW
- Contact:
Re: GCA Google maps with OpenStreetMap option
Given OSMtah is no more (link) I thought it might be worth updating my little javascript contribution.
Since I wrote the current script Open Cycle Map have confirmed their position in favour of third party use of their tiles. (link)
Updated code snippet below should change the map option from OSMtah to OCM.
Since I wrote the current script Open Cycle Map have confirmed their position in favour of third party use of their tiles. (link)
Updated code snippet below should change the map option from OSMtah to OCM.
Code: Select all
var copyOSM = new GCopyrightCollection("<a href=\"http://www.openstreetmap.org/\">© OpenStreetMap</a> (and) contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>");
copyOSM.addCopyright(new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, " "));
var copyOCM = new GCopyrightCollection("<a href=\"http://www.opencyclemap.org/\">© OpenCycleMap</a>, <a href=\"http://www.openstreetmap.org/\">© OpenStreetMap</a> (and) contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>");
copyOCM.addCopyright(new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, " "));
var tilesMapnik = new GTileLayer(copyOSM, 1, 17, { tileUrlTemplate: 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png' });
var tilesOCMrender = new GTileLayer(copyOCM, 1, 17, { tileUrlTemplate: 'http://tile.opencyclemap.org/cycle/{Z}/{X}/{Y}.png' });
var mapMapnik = new GMapType([tilesMapnik], G_NORMAL_MAP.getProjection(), "OSM");
var mapOCMarender = new GMapType([tilesOCMrender], G_NORMAL_MAP.getProjection(), "OCM");
map.addMapType(mapMapnik);
map.addMapType(mapOCMarender);