ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Map Snippets

by geraldarthur ST2/ST3

A set of custom web mapping snippets for Sublime Text 2/3

Labels snippets

Details

  • 2015.10.06.18.12.21
  • github.​com
  • github.​com
  • 2 years ago
  • 2 hours ago
  • 4 years ago

Installs

  • Total 452
  • Win 299
  • OS X 93
  • Linux 60
Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29
Windows 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0
Linux 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime Text Web Mapping Snippets

Work in progress.

Type the snippet shortcode and then press Tab to complete the snippet. Each shortcut provides a basic HTML page skeleton for the latest version of popular JavaScript mapping APIs.

The snippets are listed below in alphabetical order. The '$1' indicates the position of the caret/s. Any snippet that has a $1/$2/$3/etc. uses this technique. Pressing tab will cycle you through these positions.

Feel free to expand upon these snippets as you please.


gmaps

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map-canvas { height: 100% }
    </style>
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=$1&sensor=$2">
    </script>
  </head>
  <body>
    <div id="map-canvas"/>
    <script type="text/javascript">
      function initialize() {
        var map = new google.maps.Map(document.getElementById("map-canvas");
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </body>
</html>

leaflet

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>$1</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
  <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
  <style type="text/css">
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
  <div id="map"></div>
  <script>
    var map = L.map('map');
    L.tileLayer('http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', {
        key: $2,
        styleId: "997",
        attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>'
    }).addTo(map);
    $3
  </script>
</body>
</html>

mapbox

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>$1</title>
  <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
  <script src='//api.tiles.mapbox.com/mapbox.js/v1.6.0/mapbox.js'></script>
  <link href='//api.tiles.mapbox.com/mapbox.js/v1.6.0/mapbox.css' rel='stylesheet' />
  <style>
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
  <div id="map"></div>
  <script type="text/javascript">
    var map = L.mapbox.map('map', 'examples.map-9ijuk24y');
    $2
  </script>
</body>
</html>

ol3 (OpenLayers 3) “html <!doctype html>

.map { height: 400px; width: 100%; } adsadas