Skip to content

Instantly share code, notes, and snippets.

View jsanz's full-sized avatar
🗺️
Mapping

Jorge Sanz jsanz

🗺️
Mapping
View GitHub Profile
@springmeyer
springmeyer / degress2meters.js
Last active August 22, 2024 14:22
convert from long/lat to google mercator (or EPSG:4326 to EPSG:900913)
// See https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames for more details.
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
x= -77.035974
@bergie
bergie / README.md
Created May 30, 2012 12:47
Backbone.js Collection View example

This is an example of using a Collection view with Backbone.

@oscarfonts
oscarfonts / review.sh
Created June 3, 2012 18:43
Script per automatitzar la revisió de traduccions d'OSGeo-Live
###########################################################################
# Script per automatitzar la revisió de traduccions d'OSGeo-Live
###########################################################################
#
# Converteix a UTF8, treu el BOM, converteix CRLF a UNIX, copia els nous
# continguts al checkout local del repo, compila els html i els obre en FF.
#
# Llavors cal: revisar l'aspecte visual de cada document, corregir-lo si
# convé, i fer 'svn commit'.
#
@walkermatt
walkermatt / osgb_map.js
Created July 2, 2012 18:25
Leaflet Map using Proj4Leaflet to display a projected TMS base map from MapProxy
// Bounding box of our TMS that define our area of interest
var bbox = [-600000, -300000, 1300000, 1600000];
// Resolutions of our TMS that the tiles will be displayed at calculated so
// that at resolution 0 the bounds fit one 256x256 tile: (maxx - minx)/256
var res = [7421.875, 3710.9375, 1855.46875, 927.734375];
// Define the Proj4Leaflet coordinate reference system base on British National Grid
var crs = L.CRS.proj4js(
'EPSG:27700',
@zhm
zhm / mbtiles_delete_zoom_level.sql
Created October 3, 2012 23:09
Delete zoom levels from an MBTiles file (set max zoom)
-- change 18 to whatever the max zoom level you want in your MBTiles
DELETE FROM images WHERE
tile_id IN (SELECT tile_id FROM map WHERE zoom_level > 18) AND
tile_id NOT IN (SELECT tile_id FROM map WHERE zoom_level <= 18);
DELETE FROM map WHERE zoom_level > 18;
UPDATE metadata SET value = '18' WHERE name = 'maxzoom';
@jatorre
jatorre / gist:3892665
Created October 15, 2012 14:14
How to do many updates in a single query WAY faster
UPDATE counties_results o SET pres_dem_pct = n.pres_dem_pct, pres_gop_pct = n.pres_gop_pct,
pres_oth_pct = n.pres_oth_pct, pres_pctrpt = n.pres_pctrpt
FROM ( VALUES
(48.51, 39.69, 11.8, 100, 'AK', '02000'),
(51.65, 41.67, 6.68, 100 , 'AL' , '01001' ),
(52.14, 42.4, 5.46, 100 , 'AL' , '01003' ),
(51.94, 42.24, 5.82, 100 , 'AL' , '01005' ),
(60.28, 34.95, 4.76, 100 , 'AL' , '01007' ),
(53.19, 42.04, 4.77, 100 , 'AL' , '01009' ),
(45.07, 50.85, 4.08, 100 , 'AL' , '01011' ),
@acanimal
acanimal / gist:4183609
Created December 1, 2012 17:59
SublimeText2 current user preferences
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 10,
"highlight_line": true,
"rulers": [80,120],
"draw_minimap_border": true
}
@acanimal
acanimal / gist:4533748
Created January 14, 2013 21:34
Boilerplate code to create custom jQuery plugins
/**
* On the head set the plugin's name, version, author details and license
* for example, for example:
*
* ------------------------------------------------------------------------
*
* jquery-plugin.js Version 0.1
* jQuery Plugin Boilerplate code helps creating your custom jQuery plugins.
*
@andrewxhill
andrewxhill / cdb_import.sh
Last active December 19, 2015 02:39 — forked from luisbosque/cdb_import.sh
Import CartoDB file with cURL
#!/bin/bash
CDB_USER=$1
API_KEY=$2
IMPORT_FILE=$3
if [[ -z $CDB_USER ]]
then
echo "Missing user"
fi
@DavidHernandez
DavidHernandez / Sci-fi books
Last active January 25, 2016 15:12
David's Sci-Fi book collection
The moon is a harsh mistress - Robert A. Heinlein - 5*
A canticle for Leibowitz - Walter M. Miller 4*
Flowers for Algernon - Daniel Keyes 5*
The Forever War - Joe Haldeman - 4*
The Stars my destination (also known as Tiger! Tiger!) - Alfred Bester - 5*
The Road - Cormac Mc Carthy - 4*
God is Dead - Ron Currie Jr. - 4*
The world without us - Alan Weisman (not really sci fi, but interesting, anyways) - 4*
Animal Farm - George Orwell - 5*
1984 - George Orwell - 5*