MELIH BASARANER wrote:
>
> I have a problem with MapBasic. I have 2 tables. I want to find the
> distances from an object selected on a table1 (Buildings) to objects in
> table2 (public services). My tables' coordinate systems are Non-earth(m).
> So, I need Cartesian distances. When I try to find them in MI SQL, there
is
> not a problem. But when I try to use MapBasic for finding distances, the
> results are wrong. How can I find correct distances? Thanks in advance for
> your help.

You don't state whether the distances are only slightly wrong, or
extremely wrong.

> ******************************************************
> MB codes are as follows:
>
> Set Map CoordSys NonEarth units "m"

Here's your problem.  See Below.

> Distance type Cartesian
>
> x = centroidx(selection.obj)
> y = centroidy(selection.obj)
>
>
> select
> BUILDING_NAME,CartesianDistance(x,y,centroidx(obj),centroidy(obj),"m")
> "Distance(m)"
> from public_services order by col2 into PS_Distance
> browse * from PS_Distance
> end sub

The "set Map Coordsys" statement above only changes the
projection of the frontmost map window.  You need to change the
"current MapBasic coordsys" which is the coordinate system
used for the return values of CentroidX() and Centroidy().

Use

Set Coordsys Nonearth Units "in"

instead.

Hope this helps,
Spencer


----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to