Skip to content

Instantly share code, notes, and snippets.

@nerik
Created February 17, 2016 09:07
Show Gist options
  • Save nerik/21075945d88301337208 to your computer and use it in GitHub Desktop.
Save nerik/21075945d88301337208 to your computer and use it in GitHub Desktop.
toggleMapView - Another awesome CartoDB viz !
Another awesome CartoDB viz !
{
"env": {
"browser": true,
"node": false,
},
"rules": {
"quotes": [2, "single"],
}
}
node_modules/
*.log
.DS_Store
�PNG

IHDR(-SgAMA�� �asRGB��� cHRMz&�����u0�`:�p��Q<�PLTE���+�6��)�������k��V�������������j��d��x��b��[��Y��\��k��Z��U��R��U�����q��c��^��W��O��N��V��a��i��Z��X��Z��U��M��M��R��Y��g�����n��\��V��P��V��T��M��N��V��Y��^��^��O��N��O��M��L��N��Q��X��l�����W��Q��O��X��`��t��V��P��N��W��^��s��\��V��O��M��M��L��W��b�����g��]��V��O��O��T��T��O��U��[�����k��\��V��O��N��V��[��X��O��U��h��j��[��U��P��W��]��[��W��Z�����a��[��Y��Z��_��_��i�����b��]��\��]��c��\��\��^��L��L��M��M��L��L�����C�'��tRNS CcB��8,���{-k�����;
>�������V�������I9���E���"/������.���а��20���œ��W
7��ggyN Z�+
 Y�) Y�&abKGD�H pHYsHHF�k>�IDAT�c��^>~0��gaD0���KHJ��ed������*�j��Z�:� =}C#c�NS3s ���RΪ��ƶ����щ����ŵ��Ӯ��=X<��{:����׏���? 0� 
gg�������싍�OHLJYː�����������qX~AaQqIiYy���U�5�u� 0�0465�pr1�=������ �7V.5��4�2%tEXtdate:create2015-04-14T20:41:29+00:00�Ǽ�%tEXtdate:modify2015-04-14T20:41:29+00:00��*FtEXtsoftwareImageMagick 6.7.8-9 2014-05-12 Q16 http://www.imagemagick.org܆�tEXtThumb::Document::Pages1���/tEXtThumb::Image::height192r�tEXtThumb::Image::Width192Ӭ!tEXtThumb::Mimetypeimage/png?�VNtEXtThumb::MTime14290440890�ptEXtThumb::Size0BB��>�VtEXtThumb::URIfile:///mntlog/favicons/2015-04-14/9a3756a26ad16791275ffa14429a698b.ico.png��mIEND�B`�
html, body, #map {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Another awesome CartoDB viz !</title>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<link rel="stylesheet" href="index.css" media="screen">
<link rel="icon" type="image/png" href="./favicon.png">
<script src="//localhost:9091"></script>
</head>
<body>
<div id="map"></div>
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>
<script type="text/javascript" src="index.js"></script>
</body>
</html>
function main() {
cartodb.createVis('map', 'http://documentation.cartodb.com/api/v2/viz/2b13c956-e7c1-11e2-806b-5404a6a683d5/viz.json', {
shareable: true,
title: true,
description: true,
search: true,
tiles_loader: true,
center_lat: 0,
center_lon: 0,
zoom: 2
})
.done(function(vis, layers) {
// layer 0 is the base layer, layer 1 is cartodb layer
// setInteraction is disabled by default
layers[1].setInteraction(true);
layers[1].on('featureOver', function(e, latlng, pos, data) {
cartodb.log.log(e, latlng, pos, data);
});
// you can get the native map to work with it
var map = vis.getNativeMap();
// now, perform any operations you need
// map.setZoom(3);
// map.panTo([50.5, 30.5]);
})
.error(function(err) {
console.log(err);
});
}
window.onload = main;
{
"name": "toggleMapView",
"version": "0.0.1",
"description": "Another awesome CartoDB viz !",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "true ",
"livereload": "live-reload --port 9091 .",
"open": "opener http://localhost:9090",
"serve": "http-server -s -p 9090 .",
"dev": "npm run build -s && (sleep 1 && npm run open -s) & npm run livereload -s & npm run serve",
"gist": "echo 'Another awesome CartoDB viz !' > '..toggleMapView' && gistup && gistup-rename 'toggleMapView - Another awesome CartoDB viz !'"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nerik/generator-cartodb.git"
},
"keywords": [
"cartodb"
],
"author": "nerik",
"license": "ISC",
"bugs": {
"url": "https://github.com/nerik/generator-cartodb/issues"
},
"homepage": "https://github.com/nerik/generator-cartodb#readme",
"devDependencies": {
"http-server": "^0.8.5",
"live-reload": "^1.1.0",
"opener": "^1.4.1",
"gistup": "^0.1.2",
"eslint": "^2.0.0"
},
"dependencies": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment