Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save anderser/332187 to your computer and use it in GitHub Desktop.
Save anderser/332187 to your computer and use it in GitHub Desktop.
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src=""></script>
<style type="text/css">
body{font:12px/1.231 arial,helvetica,clean,sans-serif;}
<!--More info on using custom base layers in Google Maps v3:>
<script type="text/javascript">
function StatkartMapType(name, layer) {
this.layer = layer = name
this.alt = name
this.tileSize = new google.maps.Size(256,256);
this.maxZoom = 19;
this.getTile = function(coord, zoom, ownerDocument) {
var div = ownerDocument.createElement('DIV'); = this.tileSize.width + 'px'; = this.tileSize.height + 'px'; = "url(" + this.layer + "&zoom=" + zoom + "&x=" + coord.x + "&y=" + coord.y + ")";
return div;
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(60,9),
mapTypeControlOptions: {
mapTypeIds: ['kartdata2', 'sjo_hovedkart2', 'topo2', 'topo2graatone', 'toporaster2', 'europa'],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
map.mapTypes.set('sjo_hovedkart2',new StatkartMapType("Sjo hovedkart", "sjo_hovedkart2"));
map.mapTypes.set('kartdata2',new StatkartMapType("Kartdata 2", "kartdata2"));
map.mapTypes.set('topo2',new StatkartMapType("Topografisk", "topo2"));
map.mapTypes.set('topo2graatone',new StatkartMapType("Graatone", "topo2graatone"));
map.mapTypes.set('toporaster2',new StatkartMapType("Toporaster", "toporaster2"));
map.mapTypes.set('europa',new StatkartMapType("Europa", "europa"));
var marker = new google.maps.Marker({
position: new google.maps.LatLng(60, 9),
map: map
<body onload="initialize()">
<div id="map_canvas" style="width:600px; height:400px"></div>
<div style="width:600px;text-align:right"><a href="">Statens kartverk</a>,
<a href="">Geovekst</a> og
<a href=";action=Article.publicShow;ID=14194">kommuner</a></div>
Copy link

If I wanted to use this but I want to be able to add and remove markers with an existing google map that I have, what code will I have to add to this source to load that specific google map markers and only show the markers on the sjøkart layer? That way it will be easy for anyone to edit the locations from the out of box solution google allready provide.

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