Subscribe to this thread
Home - General / All posts - shortest path GeomDistance
lionel

519 post(s)
#13-Feb-18 23:36

I search top know the shortest line path beetwwen a shape and a point !!

in the mxb area and point are in the same row

it is a bit like https://stackoverflow.com/questions/28002162/closest-distance-to-border-of-shape but for point locate out of the shape !!!

A) so because relative to distance i search for distance in query builder and i find GeomDistance

In this context what mean the euclidean distance ?

GeomDistance(<geom>, <geom>, <tolerance>) : <value>

Takes two geoms and returns the Euclidean distance between the geoms, reported in whatever units are used for the geoms. The geoms are assumed to be in the same coordinate system. A tolerance of zero means automatic tolerance.

B) in a way i want to find the coordinate point locate in the edge of the geom and store it in another geom column ( not create in the mxb, need to goto schema ... ) . I don't know if the enclose circle can be usefull for compute this !!!

C) any clue about he best way to achieve this ? i think we need to compute for each point in the geom the distance and take the short value and id 2 short value appear then the shortest is the point locate in the midlle of this 2 points !! right ?

using implicit loop The logic seem to be

1) convert shape to point coordinate

2) for each point compute distance beetween the 2 points

3) take the min value and be shure it is unique

4) if not unique no answer stop

D) Does the result could be achieve using SQL only ?

Attachments:
distance.mxb
distance.png


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

lionel

519 post(s)
#13-Feb-18 23:49

Ok i think this llink give the algo https://bl.ocks.org/mbostock/8027637

So need to understand the logic and see if i can convert/use D3js/javascript in/with manifold . in js we need to use mouse event coordinate event that is fixed coordinate in mt context !!


join image "Because my dad promised me" interstellar from Manifold: Time by Stephen Baxter. power Math destruction

adamw


8,259 post(s)
#14-Feb-18 07:08

The algorithm in the link is slightly different than what is needed here.

The straightforward algorithm is to project coordinate to all segments and select closest projection.

We will add a query function to project coordinate to geom.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.