Skip to content

Instantly share code, notes, and snippets.

View am2222's full-sized avatar
:octocat:
Busy

Majid Hojati am2222

:octocat:
Busy
View GitHub Profile
@am2222
am2222 / rotating-emoji-globe.html
Last active September 19, 2023 18:37 — forked from simonw/rotating-emoji-globe.html
Rotating emoji globe
<!DOCTYPE html>
<html>
<head>
<title>Globe Emoji Animation</title>
<style>h1 { font-size: 70vh; text-align: center; padding: 0; margin: 0 }</style>
</head>
<body>
<h1>🌎</h1>
<script>
const globeEmojis = ['🌎', '🌍', '🌏'];
@am2222
am2222 / bbox2geohashes.js
Created June 24, 2023 04:24 — forked from mjaakko/bbox2geohashes.js
Converts a bounding box to geohashes
//Converts a bounding box bounded by minLat and maxLat and minLng and maxLng to a list of geohashes (e.g. ["60;24/19/84", "60;24/19/85"]) used for MQTT topic filters
function bbox2geohashes(minLat, minLng, maxLat, maxLng) {
var deltaLat = maxLat - minLat;
var deltaLng = maxLng - minLng;
var geohashLevel = Math.max(Math.ceil(Math.abs(Math.log10(deltaLat))), Math.ceil(Math.abs(Math.log10(deltaLng))));
var delta = Math.pow(10, -geohashLevel);
var geohashes = [];
@am2222
am2222 / pgSpatialIndex.md
Last active March 27, 2023 04:21
Spatial Indexes
  • We create a random set of the points (n=1000000)
Drop table if exists points;
CREATE TABLE points AS 
select ST_GeoHash(the_geom) as geohash, ST_SetSRID(the_geom,4326) as the_geom from 
(select (st_dump(ST_GeneratePoints(ST_MakeEnvelope(-180, -90, 180, 90),1000000))).geom as the_geom ) t1 ;
# Header
## Header 2
@am2222
am2222 / earthk_.csv
Last active February 14, 2023 17:16
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 22 columns, instead of 1. in line 5.
time,latitude,longitude,depth,mag,magType,nst,gap,dmin,rms,net,id,updated,place,type,horizontalError,depthError,magError,magNst,status,locationSource,magSource
2023-02-13T16:59:46.900Z,20.1883335113525,-155.784164428711,4.15999984741211,2.88000011,md,22,306,,0.319999993,hv,hv73323822,2023-02-13T17:22:31.886Z,"5 km SSE of Kapaau, Hawaii",earthquake,2.54,1.34000003,2.88000011,4,automatic,hv,hv
2023-02-13T16:08:57.880Z,18.1673333333333,-67.3841666666667,5.72,3.16,md,15,220,0.212,0.25,pr,pr71396193,2023-02-13T16:42:52.470Z,"22 km SW of Stella, Puerto Rico",earthquake,0.58,0.56,0.123500602585256,9,reviewed,pr,pr
2023-02-13T14:58:06.390Z,45.1249,23.1555,10,5,mb,82,26,1.177,0.8,us,us6000jnl6,2023-02-13T17:21:38.609Z,"1 km SW of Dobrița, Romania",earthquake,5.33,1.85,0.057,99,reviewed,us,us
2023-02-13T14:47:31.940Z,17.962,-66.7468333333333,10.5,2.71,md,11,163,0.07167,0.1,pr,pr71396183,2023-02-13T15:07:19.370Z,"4 km SW of Tallaboa, Puerto Rico",earthquake,0.43,0.69,0.207519915782661,8,reviewed,pr,pr
2023-02-13T14:20:4

GG618 Routing Algorithm Assignment

In this assginment we are going to use Pgrouting to compare multiple routing algorithems and also learn how the roads graphs are being stored in the database

image text

Credits:

This assignment is mainly based on the following workshop

An Overview about the different tools we are using

Please have a look at the following page to have a grasp about pgrouting

PGIS Intro

Spatial Stuff!

Postgres Extensions

Installing Postgis (Postgres Extension)

#Add Postgis extension:

create extension postgis
@am2222
am2222 / gdal-centos7.md
Created January 24, 2023 00:51 — forked from alanorth/gdal-centos7.md
Install GDAL 2.4.2 on CentOS 7

Install Proj

GDAL needs Proj:

$ cd /tmp
$ wget https://download.osgeo.org/proj/proj-6.1.1.tar.gz
$ tar xf proj-6.1.1.tar.gz 
$ cd proj-6.1.1
$ ./configure --prefix=/export/apps/proj/6.1.1
$ make -j4