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 = [];

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
@am2222
am2222 / gist:1f521f34eb520a4b881ed7d290f7b248
Created April 3, 2020 16:41 — forked from singhabhinav/gist:132b8196abac026b43fa
Install SSL certificate in Nginx (Using .crt & .ca-bundle certificate files)
Step 1 - Create .crt file
cat domainname.crt domainname.ca-bundle > domainname-ssl-bundle.crt
Step 2-
Add lines for ssl_certificate in nginx configuration
server {
listen 80 default_server;
@am2222
am2222 / shp2spatialite.py
Created May 10, 2018 18:10 — forked from kylefelipe/shp2spatialite.py
importing a SHP to a Spatialite
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python 2
import os
from sqlite3 import dbapi2 as db
db_folder = "/"
db_name = "test"
@am2222
am2222 / App.java
Created April 10, 2018 12:28 — forked from dwins/App.java
is this the minimal code to render a shapefile with geotools?
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.net.URL;
import javax.imageio.ImageIO;
import org.geotools.data.FeatureSource;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.geometry.jts.ReferencedEnvelope;
@am2222
am2222 / gist:d4157ebd446592b4f29ff1fae4033e58
Created April 19, 2017 06:04 — forked from quommit/gist:4633786
C# routing application for calculating a set of shortest paths from a series of predefined start and end locations. Each start node can be assigned an integer load value which accumulates on its corresponding end node. In order to compile this code, download and reference NetTopologySuite, an open source spatial analysis library, and QuickGraph,…
using System;
using System.Collections.Generic;
using System.IO;
using GeoAPI.Geometries;
using NetTopologySuite.Features;
using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
using System.Globalization;
namespace ShortestPath