Skip to content

Instantly share code, notes, and snippets.

View Youssef-Harby's full-sized avatar
🌍

Youssef Harby Youssef-Harby

🌍
View GitHub Profile
@Youssef-Harby
Youssef-Harby / geoparquet_metadata_point_example.py
Created April 23, 2024 01:44
GeoParquet 1.1 metadata example
import pyarrow as pa
import pyarrow.parquet as pq
from pathlib import Path
import json
import pandas as pd
def process_parquet_file(parquet_path):
# Read the Parquet file into a PyArrow Table
table = pq.read_table(parquet_path)
@Youssef-Harby
Youssef-Harby / aws_s3_http.py
Created January 2, 2024 16:55
Amazon S3 REST API with HTTP
import httpx
import datetime
import hashlib
import hmac
# AWS credentials
access_key = "secret"
secret_key = "secret"
region = "eu-central-1" # e.g. 'us-west-1'
bucket = "bucket-name"
@Youssef-Harby
Youssef-Harby / csv_to_geospatial.py
Created December 24, 2023 08:41
Converting CSV to Any Geospatial Format Using DuckDB and DuckDB Spatial Extension.
# dataset ref : https://www.kaggle.com/datasets/max-mind/world-cities-database/code
# pip install duckdb
import duckdb
con = duckdb.connect()
data = """
-- Environment setup
SET enable_progress_bar = true;
@Youssef-Harby
Youssef-Harby / buildings.py
Created December 15, 2023 15:01
OvertureMaps Duckdb Scripts
import duckdb
con = duckdb.connect('./duckdb.duckdb')
data = """
SET memory_limit = '32GB';
SET threads TO 16;
SET enable_progress_bar = true;
SET enable_progress_bar_print = true;
INSTALL httpfs;
INSTALL spatial;
@Youssef-Harby
Youssef-Harby / googlemapsurltoxy.py
Created August 21, 2023 09:43
How to extract X-Long and Y-Lat from google maps url
import csv
import re
def extract_lat_long(csv_file, url_column):
pattern = r".+!3d(-?\d+\.\d+)!4d(-?\d+\.\d+).+"
data = []
# Read the CSV file and extract latitude and longitude values
with open(csv_file, 'r') as f:

Keybase proof

I hereby claim:

  • I am youssef-harby on github.
  • I am yharby (https://keybase.io/yharby) on keybase.
  • I have a public key ASBmkyd87Ju7hwN_Uej1lBn8r2SbYZsl12bXghbTDcxPNwo

To claim this, I am signing this object: