Skip to content

Instantly share code, notes, and snippets.

@sigon426
sigon426 / README.md
Last active August 29, 2015 14:16
Gas stations price heatmap

Spain gas station price heatmap

Use heatmap.js to see the Spanish gas stations that serve gasolina95 over 1.3€/litre.

Gas station price list last updated on 7-mars 2015.

Data from geoportalgasolineras.es.

@sigon426
sigon426 / README.md
Last active August 29, 2015 14:12
Using Turf to find gas station within a route

Gas stations within route

Show the gas stations within a route using TurfJS

http://turfjs.org/

@sigon426
sigon426 / README.md
Last active August 29, 2015 14:05
esri-leaflet, dynamic layer with custom popup
@sigon426
sigon426 / AnimatedMarker.js
Last active July 27, 2017 20:25
Orthodrome animated flight path
L.AnimatedMarker = L.Marker.extend({
options: {
// meters
distance: 200,
// ms
interval: 1000,
// animate on add?
autoStart: true,
// callback onend
onEnd: function(){},
@sigon426
sigon426 / OSMBuildings-Leaflet.js
Last active June 19, 2023 16:16
3D Tower made with Leaflet and OSMbuildings
var OSMBuildings=function(){function La(a,c){var b=a.x-c.x,e=a.y-c.y;return b*b+e*e}function rb(a){for(var c=0,b=0,e=0,d=a.length-3;e<d;e+=2)c+=a[e],b+=a[e+1];a=(a.length-2)/2;return{x:c/a<<0,y:b/a<<0}}function ta(a,c){var b={};a/=U;c/=U;b[sb]=0>=c?90:1<=c?-90:Ma*(2*tb(ub(I*(1-2*c)))-M);b[vb]=360*(1===a?1:(a%1+1)%1)-180;return b}function Na(a,c,b){function e(a){if("XDomainRequest"in fa&&a!==d.readyState&&(d.readyState=a,d.onreadystatechange))d.onreadystatechange()}a=a.replace(/\{ *([\w_]+) *\}/g,
function(a,b){return c[b]||a});var d="XDomainRequest"in fa?new XDomainRequest:new XMLHttpRequest;d.onerror=function(){d.status=500;d.statusText="Error";e(4)};d.ontimeout=function(){d.status=408;d.statusText="Timeout";e(4)};d.onprogress=function(){e(3)};d.onload=function(){d.status=200;d.statusText="Ok";e(4)};d.onreadystatechange=function(){4===d.readyState&&d.status&&!(200>d.status||299<d.status)&&b&&d.responseText&&b(JSON.parse(d.responseText))};e(0);d.open("GET",a);e(1);d.send(null);e(2);return d}
function V(){W.re
> db.geospacial.find( { geo :{ $geoIntersects :{ $geometry : { type : "Point" , coordinates : [2.188854217529297,41.38875469223532] } } } }, {_id:1} )
{ "_id" : ObjectId("526bec2067dfe0c38d8b2ffe") }
> mongo
> use geospatial
switched to db geospatial
> db.geometrias.find()
> db.geometrias.insert({geo: {type: "Polygon",coordinates: [[ [2.1849489212036133, 41.38680675397411], [2.1849489212036133, 41.39039671055913], [2.1898841857910156, 41.39039671055913], [2.1898841857910156, 41.38680675397411],[2.1849489212036133, 41.38680675397411] ]] }})
> db.geometrias.insert({geo: {type: "Polygon",coordinates: [[ [2.186858654022217, 41.389913768298356], [2.186858654022217, 41.392392833843616], [2.194089889526367, 41.392392833843616], [2.194089889526367, 41.389913768298356], [2.186858654022217, 41.389913768298356] ]] }})
@sigon426
sigon426 / gist:6306589
Last active December 21, 2015 12:38
GeoJson on Github <embed map>
<script src="https://embed.github.com/view/geojson/mappingCo/BCN/master/MurallaRomana.geojson"></script
function creaChart(cartoData,barrio){
$('#highchart').highcharts({
chart: {
type: 'line',
marginRight: 50,
marginBottom: 50,
marginTop:100
},
title: {
text: 'Distribución Renta BCN | Indice RFD',
layer.on('featureClick', function(e, pos, latlng, data) {
charts(data.cartodb_id);
});