Page 1 of 1

Recommended geometry frameworks for mapping usecases

Posted: Fri Dec 22, 2017 11:43 am
by Bernd Welter
Hi there,

every once in a while I get asked for topics such as
  • how to calculate a meaningful (convex?) polygon that contains a set of coordinates (e.g. my customers)?
  • how to determine the post code area that contains a given point?
  • how to determine whether two areas intersect
Such questions are dealing with geometry operations which are usually outside the functional scope of PTVs components.
Depending on the runtime you use (Java, .NET, JavaScript, ... ) you can use third party / open source libraries that offer geometry functions such as
  • POLYGON intersection (POLYGON, POLYGON)
  • BOOLEAN point in polygon(POLYGON, POINT)
  • POLYGON convexhull(POINTS[])
  • BOOLEAN intersects(POLYGON,POLYGON)
Some frameworks we can recommend for that are
Even Microsoft SQL Server or Oracle databases support these functions. The term you have to look for is SPATIAL:
https://docs.microsoft.com/en-us/sql/re ... sql-server

Of course sometimes you also need geometry data such as ZIPCODE areas or COUNTRY borders but that is a question of data broking which can be provided by PTV's Digital Data Services (http://www.ddsgeo.de/)

Best regards,
Bernd

Re: Recommended geometry frameworks for mapping usecases

Posted: Fri Dec 22, 2017 1:16 pm
by Oliver Heilig
Some additions, with actual samples:

.NET (Framework)

Reading/Writing data-formats, Map-Rendering SharpMap https://www.nuget.org/packages/SharpMap/.
Sample with xServer https://github.com/ptv-logistics/SharpMap.Widgets

JS

Simple mapping functions (geo-distance / pointInPolygon) Leaflet + Plugins.
Sample with xServer: https://github.com/ptv-logistics/xserve ... oi-locator

Complex functions (working with TopoJson / Topologies) D3 https://d3js.org/.
Sample with xSever: https://github.com/ptv-logistics/xserve ... in-regions

Voronoi-Diagrams: D3-Voronoi https://github.com/d3/d3-voronoi
Sample with xServer: https://github.com/oliverheilig/voronoi-territories

Oli