[Manifold-l] Distance calculations

Simon Linder pslinder at earthlink.net
Wed Sep 20 12:38:56 CDT 2006


I finally got the distance to work approximately with the following script:

Function DStudio
   Set p = Application.NewGeomFromTextWKT("POINT(-77.076967 38.965717)")
   DStudio = Record.Object.Geom.Distance(p,.001)*6378137.0 * 3.14/180/1609'
in miles
End Function

The stuff I added was to convert degrees into miles (the hard way; also
inaccurate but close enough for my purposes).  I still do not understand why
Adam's initial script delivered degrees instead of meters.  Also I do not
understand why when I tried to do this in a query instead of an Active
column the ,"mi" did not work with the distance function.  

I found this whole process to be remarkably difficult.  Is it possible that
a function as basic as finding the distance from a bunch of points to a
single one requires that the user either knows or has to learn VB Scripting?
I am not sure that Manifold (despite its incredible power and low price)
will achieve its goal of making GIS universal unless it can make such basic
functions a lot easier for the average (or even subaverage -like me I am
afraid) user.

Simon Linder
Wider Networks
slinder at widernetworks.com
(w) 301.951.2767
(m) 301.768.9170

-----Original Message-----
From: manifold-l-bounces at lists.directionsmag.com
[mailto:manifold-l-bounces at lists.directionsmag.com] On Behalf Of Lorne
Sent: Wednesday, September 20, 2006 8:01 AM
To: slinder at widernetworks.com; adamw at manifold.net;
manifold-l at lists.directionsmag.com
Subject: RE: [Manifold-l] Distance calculations

Hi Simon

When I first ran Adam's script under the Debugger, the value for Dstudio
being calculated; however, the column was not updating. I discovered that I
had set the function type to Int32. Resetting it to a floating point number
solved the problem.  Right click on the Dstudio column name and select Edit.
Check the return type.

Lorne

-----Original Message-----
From: manifold-l-bounces at lists.directionsmag.com
[mailto:manifold-l-bounces at lists.directionsmag.com] On Behalf Of Simon
Linder
Sent: September 19, 2006 8:37 PM
To: adamw at manifold.net; manifold-l at lists.directionsmag.com
Subject: RE: [Manifold-l] Distance calculations


Adam,

Thanks for your help.  I tried your suggestion and all I got was 0.  I
changed the ",.001)" to Geom (I) so the second point would be taken from the
record but I still just get 0.

I then tried to do this with a select query:

SELECT
Distance(Geom ([ID]),NewPointLatLon(-77.0770,38.9657)) FROM [Usps 2 Table]

This works.  I get distance in degrees however when I modify the query to
what is below to get the distance in miles:

SELECT
Distance(Geom ([ID]),NewPointLatLon(-77.0770,38.9657),"mi") FROM [Usps 2
Table]

I then get nothing in the resulting column.  I know this is probably my
fault but any guidance would be helpful

Simon Linder
Wider Networks
slinder at widernetworks.com
(w) 301.951.2767
(m) 301.768.9170
-----Original Message-----
From: manifold-l-bounces at lists.directionsmag.com
[mailto:manifold-l-bounces at lists.directionsmag.com] On Behalf Of
adamw at manifold.net
Sent: Tuesday, September 19, 2006 8:52 AM
To: manifold-l at lists.directionsmag.com
Subject: RE: [Manifold-l] Distance calculations

> I am getting a type Mismatch error on NewPointLatLon when I set up the 
> following function in an ActiveColumn:
>
>  Function DStudio
>    DStudio = distance([Geom 
> (I)],NewPointLatLon(-77.0770,38.9657),"mi")
>  End Function

You are using query functions in a script.

Try this:

 Function DStudio
   Set p = Application.NewGeomFromTextWKT("POINT(-77.0770 38.9657)")
   DStudio = Record.Object.Geom.Distance(p, 0.001) / 1609 ' in miles  End
Function

--
Adam Wachowski
Manifold Development Team



_______________________________________________
Manifold-l mailing list
Manifold-l at lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/manifold-l

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/451 - Release Date: 9/19/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/451 - Release Date: 9/19/2006
 

_______________________________________________
Manifold-l mailing list
Manifold-l at lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/manifold-l
_______________________________________________
Manifold-l mailing list
Manifold-l at lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/manifold-l

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/451 - Release Date: 9/19/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/451 - Release Date: 9/19/2006
 



More information about the Manifold-l mailing list