Skip to content

Instantly share code, notes, and snippets.

View oliverheilig's full-sized avatar
💾
Loading...

Oliver Heilig oliverheilig

💾
Loading...
View GitHub Profile
@oliverheilig
oliverheilig / Transform.cs
Last active August 15, 2023 12:41
GeoTransform
// This snippet contains methods to transform between the
// various "coordinate formats" used by PTV components
using System;
public class Program
{
public static void Main()
{
var pWgs = new Point(8.4, 49.0); // Karlsruhe
var pPtv_Geodecimal =
@oliverheilig
oliverheilig / !LINK.md
Last active January 13, 2023 10:36
xServer-2 Data Integration Strategies
@oliverheilig
oliverheilig / !LINK.md
Last active January 13, 2023 10:35
In Defense of Mercator
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oliverheilig
oliverheilig / PointInsidePolygon.cs
Last active March 19, 2020 15:17
PointInsidePolygon
// This snippet shows how to check whether a point is
// contained in a polygon. Works for all polygons, even for
// OGC-invalid ones, corresponding to "fill mode" alternate.
// You can use this for geo-fencing or UI hit-testing.
using System;
using System.Collections.Generic;
using JSIL;
using JSIL.Meta;
public class Program
@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

@oliverheilig
oliverheilig / DouglasPeuckerReduction.cs
Last active October 9, 2017 07:27
DouglasPeuckerReduction
using System;
using System.Collections.Generic;
using JSIL;
using JSIL.Meta;
public static class Program
{
public static void Main()
{
Console.WriteLine("The red line is the simplified " +
@oliverheilig
oliverheilig / CohenSutherlandClipping.cs
Last active November 20, 2016 03:28
CohenSutherlandClipping
using System;
using System.Collections.Generic;
using JSIL;
using JSIL.Meta;
public static class Program
{
public static void Main()
{
Console.WriteLine("The red line is the clipped " +
@oliverheilig
oliverheilig / README.md
Last active February 6, 2016 07:34
Voronoi Territories

A visualization for the assignment of points to territories using voronoi cells.

This is done by visually merging the voronoi cells and clipping them with circluar buffers around the point. It's an alternative to the visualization with a convex hull around each particular point set, as it generates a partitioning without overlappings. You can view this sample on a map here.

I'm using Mike Bostock's wonderful D3 library to create the SVG. But rather than calculating the voronois with D3's function, i'm utilizing Raymond Hill's JavaScript implementation, as i couldn't find a way to get the corresponding regions for a cell edge. After finishing, i found that D3 allows the creation of TopoJson fom a vonoroi.topology, which may provide a more elegant way.

Grabbed the initia