Read this article here: https://blocks.roadtolarissa.com/oliverheilig/d900c3ee3d51a8ba670b445f9968f336
// 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 = |
Read this article here: https://blocks.roadtolarissa.com/oliverheilig/29e494c33ef58c6d5839
// 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 |
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
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 " + |
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 " + |
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