Skip to content

Instantly share code, notes, and snippets.

View bertt's full-sized avatar

Bert Temme bertt

View GitHub Profile
@oliverheilig
oliverheilig / CSharpGeoSnippets.md
Last active September 12, 2018 10:16
C# geo snippets

This is my list of code snippets useful when writing (geo)graphical applications in C#. Of course there are many powerful .NET libraries which handle these problems. But sometimes it is easier to just include some lines of code.

I've written the code to run directly in the browser using JSIL. You can extract the essential lines in your project. It should work for .NET, Mono, Silverlight, WinRT and Windows Phone. I've included the base types needed (Point, Rect) into the snippet. You can replace them with the appropriate type of the framework you are using.

For example: If you use the line simplification for WPF lines, you can take the System.Windows.Point. If you use it for WCF Spatial Library, you can take the [System.Spatial.GeometryPoint](http://msdn.microsoft.co

[assembly: ExportRenderer(typeof(HighlightableMap), typeof(IosHighlightableMapRenderer))]
public class IosHighlightableMapRenderer : MapRenderer
{
private MapHighlight _currentHighlight;
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
@chrishannah
chrishannah / iOS Icon Sizes.md
Last active February 15, 2022 23:43
A list containing all the icon names and sizes for iOS and watchOS.

iOS 12 Icon Sizes

(Taken from Xcode 10)

iPhone

iPhone Notification (iOS 7-12) 20pt

  • 2x - 40px
  • 3x - 60px
@bdon
bdon / example.html
Created October 13, 2022 03:43
example use of pmtiles 2.0.0 with maplibre
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Display a map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/pmtiles@2.0.0/dist/index.js"></script>
<style>
@mattdesl
mattdesl / about.md
Last active July 17, 2023 09:20
optimizing & de-duplicating geometry in GLTF files

optimize GLTF file

This optimizes a GLTF file that was exported by blender (or similar) by de-duplicating buffer views (i.e. chunks of bytes) that are equal and removing redundant accessors.

For example, 100 cubes of different scales/materials/rotations/etc should all end up using a single BufferGeometry in ThreeJS, which isn't the case with current GLTF exporters in Blender and parsers for ThreeJS.

In scenes with a lot of instancing, it can dramatically reduce total file size as well as render performance. In one test scene:

Before: 4.8MB file size, 832 THREE.Geometry instances across 832 THREE.Mesh objects
After: 661KB file size, 13 THREE.Geometry instances across 832 THREE.Mesh objects

@norwegianblueparrot
norwegianblueparrot / bourtange.R
Last active November 25, 2023 03:40
A script to produce a 3D render of Fort Bourtange from LiDAR data
## ----setup,include=FALSE,message=FALSE,warning=FALSE-----------------------------------------------------------------------------------------------------------------------------------------------------
library("here") # 1.0.1
library("sf") # 1.0-14
library("rgl") # 1.2.1
library("geoviz") # 0.2.2
library("raster") # 3.6-26
library("rayshader") # 0.35.7
library("osmdata") # 0.2.5
library("tidyverse") # 2.0.0
@richlander
richlander / Dockerfile
Created June 14, 2018 00:57
ASP.NET Web Forms Multi-stage build Dockerfile
FROM microsoft/dotnet-framework:4.7.2-sdk AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
COPY aspnetapp/*.config ./aspnetapp/
RUN nuget restore
# copy everything else and build app
@jhmt
jhmt / Vincenty.cs
Created June 14, 2020 06:42
C# implementation of Vincenty's formula direct problem
using System;
namespace Vincenty
{
public class Vincenty
{
private double RadiusLong = 6378137.0;
private double Flatts = 1 / 298.257222101;
private double RadiusShort => RadiusLong * (1 - Flatts);
@shinyzhu
shinyzhu / GooglePoints.cs
Last active February 7, 2024 12:13
Encode/Decode Polyline Algorithm Format in C#
/// <summary>
/// See https://developers.google.com/maps/documentation/utilities/polylinealgorithm
/// </summary>
public static class GooglePoints
{
/// <summary>
/// Decode google style polyline coordinates.
/// </summary>
/// <param name="encodedPoints"></param>
/// <returns></returns>
@govert
govert / GpsUtils.cs
Last active March 25, 2024 08:43
Convert WGS-84 geodetic locations (GPS readings) to Cartesian coordinates in a local tangent plane (Geodetic to ECEF to ENU)
using System;
using System.Diagnostics;
using static System.Math;
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis.
// The implementation here is according to the paper:
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01.
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'"
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum