Skip to content

Instantly share code, notes, and snippets.

View kbevers's full-sized avatar

Kristian Evers kbevers

View GitHub Profile
@kbevers
kbevers / nkg_wkt
Created December 17, 2020 10:41
NKG Transformation updates following review
$ projinfo -k operation NKG:ITRF2000_TO_NKG_ETRF00
PROJ string:
+proj=pipeline
+step +proj=helmert +x=0.054 +y=0.051 +z=-0.048 +rx=0.000891 +ry=0.00539
+rz=-0.008712 +s=0 +dx=0 +dy=0 +dz=0 +drx=8.1e-05 +dry=0.00049
+drz=-0.000792 +ds=0 +t_epoch=2000 +convention=position_vector
+step +inv +proj=deformation +t_epoch=2000.0
+grids=eur_nkg_nkgrf03vel_realigned.tif
WKT2:2019 string:
@kbevers
kbevers / gist:d372127619dc66a5d31ccab10481e00b
Last active December 16, 2020 16:50
NKG Transformations, changes after review
$ projinfo -k operation NKG:ITRF2000_TO_NKG_ETRF00
PROJ string:
+proj=pipeline
+step +proj=helmert +x=0.054 +y=0.051 +z=-0.048 +rx=0.000891 +ry=0.00539
+rz=-0.008712 +s=0 +dx=0 +dy=0 +dz=0 +drx=8.1e-05 +dry=0.00049
+drz=-0.000792 +ds=0 +t_epoch=2000 +convention=position_vector
+step +inv +proj=deformation +t_epoch=2000.0
+grids=eur_nkg_nkgrf03vel_realigned.tif
WKT2:2019 string:
@kbevers
kbevers / PROJ_progression.c
Created April 13, 2020 21:32
Difference between old PROJ style code and the 2020 equivalent
/*
* Implementation of the Guyou, Pierce Quincuncial, Adams Hemisphere in a Square,
* Adams World in a Square I & II projections.
*
* Based on original code from libproj4 written by Geral Evenden. Adapted to modern
* PROJ by Kristian Evers. Original code found in file src/proj_guyou.c, see
* https://github.com/rouault/libproj4/blob/master/libproject-1.01/src/proj_guyou.c
* for reference.
*
* Copyright (c) 2005, 2006, 2009 Gerald I. Evenden
@kbevers
kbevers / create_gie_file.py
Created April 13, 2020 20:58
Script for creating gie test data using libproject
import math
from ctypes import *
from random import random
libproject = cdll.LoadLibrary("/usr/local/lib/libproject.dylib")
def wrap_function(lib, funcname, restype, argtypes):
"""Simplify wrapping ctypes functions"""
func = lib.__getattr__(funcname)
func.restype = restype
@kbevers
kbevers / ellipsoidal_area.geojson
Created September 25, 2018 13:20
Sample polygon for area determination test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kbevers
kbevers / PJ_aeqd.c
Last active April 30, 2018 12:49 — forked from schwehr/PJ_aeqd.c
A first pass a trying to cleanup PJ_aeqd.c
/******************************************************************************
* Project: PROJ.4
* Purpose: Implementation of the aeqd (Azimuthal Equidistant) projection.
* Author: Gerald Evenden
*
******************************************************************************
* Copyright (c) 1995, Gerald Evenden
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
'''
Rename las/laz files that are tiled in the Danish Kvadratnet.
'''
from __future__ import print_function
import os
import shutil
import glob
import argparse
@kbevers
kbevers / 150327_metadata.json
Created October 3, 2016 12:52
PDAL extrabytes
{
"filename": "150327_103118.laz",
"metadata":
{
"comp_spatialreference": "COMPD_CS[\"unknown\",PROJCS[\"WGS 84 \/ UTM zone 32N\",GEOGCS[\"WGS84\",DATUM[\"unknown\",SPHEROID[\"unnamed\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",9],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]],VERT_CS[\"unknown\",VERT_DATUM[\"unknown\",2005],UNIT[\"metre\",1.0,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Up\",UP]]]",
"compressed": true,
"count": 199741487,
"creation_doy": 186,
"creation_year": 2016,
"dataformat_id": 1,
'''
Plot map data in different projections supported by proj.4
Can be called either as
> python plotproj.py proj_strings.txt [out]
or
> python plotproj.py "+proj=lcc +lat_1=20" [out]
@kbevers
kbevers / project_data.py
Last active July 7, 2016 07:26
Project lat/long with proj.4
'''
Functions for plotting map data in different projections supported by proj.4
'''
import json
import subprocess
from pprint import pprint
import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry.polygon import Polygon