Skip to content

Instantly share code, notes, and snippets.

View DavidMoraisFerreira's full-sized avatar
🐢

David Morais Ferreira DavidMoraisFerreira

🐢
View GitHub Profile
@cquest
cquest / hillshade-transparent-overlay.md
Last active July 5, 2022 06:30
transparent hillshade cooking guide using gdal

Ingredients

  • a decent DEM
  • gdal
  • some computer

compute grayscale hillshade using gdaldem

gdaldem hillshade -compute_edges your_dem_file hillshade.tif

color-ramp to compute transparency (alpha channel)

In another bowl, prepare the following shade.ramp file:

@YKCzoli
YKCzoli / Lidar_walkthrough.md
Last active November 15, 2023 18:35
Lidar_walkthrough

Processing LiDAR to extract building heights

Walk through

Detailed walk through of building extraction using postgis

First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.

LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele

Technical details for https://stackoverflow.com/a/44169445/6730571

Details of investigation:

On a base system, /usr/bin/java is a symlink that points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual java.

(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)

If you don't have Java installed, attempting to execute java will open a dialog that invites you to install it.

@grischard
grischard / create_osm_street_list.sql
Created September 11, 2018 11:08
Import and maintain openstreetmap into postgis for Luxembourg
-- The following lines must be added to /usr/local/Cellar/osm2pgsql/HEAD/share/osm2pgsql/default.style
-- # Extras for create_osm_street_list.sql
-- way postal_code text linear
-- way alt_name text linear
-- way name:lb text linear
-- way alt_name:lb text linear
-- way is_in:city text linear
DROP TABLE IF EXISTS road_names_osm;
@lxe
lxe / goes16-rtlsdr.md
Last active June 6, 2024 04:19
Receive GOES-16 and GOES-17 Images with a Raspberry Pi and RTL-SDR dongle
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Return GeoJSON centroids with population for each locality in Luxembourg.
BD-Adresses doesn't include communes, so we use the OpenStreetMap community's
csventrifuge output, which has been enriched. The output of this script is
© OpenStreetMap Contributors, see https://openstreetmap.org/copyright.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
cd /path-to-dir/LUREF_NGL/; find . -type f -iname '*.tif' >input-files.txt
docker run -it --rm -v /path-to-dir/LUREF_NGL:/data osgeo/gdal:alpine-normal-v2.4.1 sh -l
(in docker) gdalbuildvrt -resolution highest -r nearest ANA_LUREF_NGL_DTM.vrt -input_file_list input-files.txt
# Rest not in docker...
gdaladdo -ro --config COMPRESS DEFLATE --config COMPRESS_OVERVIEW DEFLATE --config ZLEVEL 9 --config BIGTIFF_OVERVIEW IF_SAFER --config GDAL_TIFF_OVR_BLOCKSIZE 512 -r nearest ANA_LUREF_NGL_DTM.vrt 4 16 64 256 1024 4096
gdaldem hillshade ANA_LUREF_NGL_DTM.vrt lu_hillshade_2017.tif -co BIGTIFF=YES -co TILED=YES -co COMPRESS=DEFLATE -co GDAL_NUM_THREADS=ALL_CPUS -of GTiff -b 1 -z 1.0 -s 0.5 -az 315.0 -alt 45.0
gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL --config BIGTIFF_OVERVIEW IF_SAFER --config GDAL_TIFF_OVR_BLOCKSIZE 512 -r average lu_hillshade_2017.tif 4 16 64 256 1024 4096
gdalwarp -t_srs epsg:3857 -r lanczos -multi -wo NUM_THREADS=ALL_CPUS A
@dannberg
dannberg / obsidian-daily-note-template.txt
Last active July 28, 2024 13:18
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[Timestamps/<% tp.date.now("YYYY", -1) %>/<% tp.date.now("MM-MMMM", -1) %>/<% tp.date.now("YYYY-MM-DD-dddd", -1) %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1) %>/<% tp.date.now("MM-MMMM", 1) %>/<% tp.date.now("YYYY-MM-DD-dddd", 1) %>|Tomorrow]] >>
---
@aneesdev
aneesdev / EnhancedEnum.php
Created September 19, 2022 18:59
EnhancedEnum PHP trait
<?php
trait EnhancedEnum
{
/**
* Get the enum value from the name. e.g case INVOICE = 'invoice'; will return 'invoice'
*
* @param string $name
* @return static
*/