[postgis-users] Off topic : Relative distance measurement
Ken Southerland
southerland at samsix.com
Wed Jan 24 11:11:09 PST 2007
You seem to be making this harder than necessary. First off is
EquatorialLength the circumference of the earth? If so, you are obviously
using a number that is way too big for comparison and its not surprising that
everything is near one.
If EquatorialLength is a variable depending on the data, then use a smaller
number and/or stretch the axis through some exponent. y = 1 - (x/C)^n
However, if your EquatorialLength is constant for all calculations and if all
you want to do is see if something is close then why not just decide what
close enough is (which you would do anyway after transforming the number to
something between one and zero only much more abstractly) and just check to
see if distance() is less than that number or not.
i.e. If you decide that close enough to be the same place (given that it has
the same names) is 100 meters than just say that anything less than 100
meters is the same place and anything greater than 100 meters is not the same
place.
Ken
On Wednesday 24 January 2007 9:53 am, Øyvind Vestavik wrote:
> Sorry for posting off topic but I was wondering if anyone have any
> thoughts on comparing two points using distance() or something similar
> and then converting the retrieved distance into a value between 0 and 1
> where 1 means that the points are the same and 0 means the points are
> as far apart as possible.
>
> i tried something like the formula below, but unless using a lot of
> desimals the metric will return 1 for all but very long distances.
>
> simGeo = 1 - (distance / (EquatorialLength / 2))
>
> The reason for this strange request is that I'm comparing gazetteer
> entries from two different sources based on their names (implemented as
> term vectors) and their locations (Points). The hypothesis is that if
> the entries share many names and have Identical or near identical points
> representing the place, they are the same place.
> To have the metrics comparable they should both be a value between 0 and
> 1, something like this.
>
> ((simVSP x weightVSP) + (simGeo x weightGeo))/2
>
> If anyone has any tips on how to transform for instance a number of
> meters to a value between 0 and 1 ?
--
------s----a----m----s----i----x------
--
Ken Southerland
Senior Consultant
Sam Six, Inc.
503-236-4288
http://www.samsix.com
More information about the postgis-users
mailing list