Skip to content

Instantly share code, notes, and snippets.

@yurukov
yurukov / find_geojson_loops.js
Last active August 29, 2015 14:17
Detecting loops in polygons and multipolygons in geojson.
var fs = require("fs");
var geojson = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
for (var n=0;n<geojson.features.length;n++) {
var feature = geojson.features[n];
var geom = feature.geometry.coordinates;
if (feature.geometry.type=='Polygon')
geom=[geom];
var list=[];
for (var i=0;i<geom.length;i++)
for (var j=0;j<geom[i].length;j++)
01 BLG
02 BGS
03 VAR
04 VTR
05 VID
06 VRC
07 GAB
08 DOB
09 KRZ
10 KNL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yurukov
yurukov / area.php
Created May 8, 2014 07:24
Calculate areas in which a person can reach a certain point within a certain time limit
<?php
mb_internal_encoding("utf8");
$askedG=0;
//takes as argiment a csv file with format "id,lat,lng"
$files = file($argv[1]);
foreach($files as $line) {
echo "Working $line\n";