Re: [MI-L] Problem with co-ordinates... Help please ???

2006-10-17 Thread Bob Young
Title: Problem with co-ordinates... Help please ???



Hi Stuart
 
Perhaps your map projection is not simple lat long. 
For example if you are using Transverse Mercator projection then fixed offsets 
in degrees will not be equal distances apart and lines of longitude and latitude 
will form curves.
 
Regards
 
 
Bob
MapsByDesign.co.uk
 

  - Original Message - 
  From: 
  Gibb, Stuart 
  
  To: mapinfo-l@lists.directionsmag.com 
  
  Sent: Monday, October 16, 2006 5:19 
  PM
  Subject: [MI-L] Problem with 
  co-ordinates... Help please ???
  
  All, 
  I am using the following snippets of code 
  to create fixed width band regions at 90 degrees to a series of given straight 
  lines. The lines contain numerical data which I can then thematically map. I 
  also have a version that creates variable width bands but for the moment I'll 
  assume all bands are the same width.
  After a lot of tweaking I thought I had 
  finished the tool...Unfortunately, after crudely holding the corner of a sheet 
  of paper up to the screen it appears my bands aren't perfectly perpendicular 
  to the original line though I am clueless as to what could have gone 
  wrong…
  Is there any error converting degrees to 
  radians and then back again in MapInfo ? Also, I am the using British national 
  grid co-ordinate set, could this where my slight discrepancy has come from 
  multiplying ?
      fFNodeX = 
  ObjectNodeX(oLine, 1, 1) ' read longitude     fFNodeY = ObjectNodeY(oLine, 1, 1) ' read 
  latitude     fTNodeX 
  = ObjectNodeX(oLine, 1, k) ' read longitude     fTNodeY = ObjectNodeY(oLine, 1, 
  k) ' read latitude 
      fA1 = fTNodeX - 
  fFNodeX     fA2 = 
  fTNodeY - fFNodeY     fLinkLength = SQR(fA1*fA1 + fA2*fA2) 
      fB1 = 
  -fA2/fLinkLength     
  fB2 = fA1/fLinkLength 
      x1 = fFNodeX + (fB1 
  *(fWidth + fOffset))     y1 = fFNodeY + (fB2 *(fWidth + fOffset)) 
      x2 = fTNodeX + (fB1 
  *(fWidth + fOffset))     y2 = fTNodeY + (fB2 *(fWidth + fOffset)) 
      x3 = fTNodeX + (fB1 * 
  fOffset)     y3 = 
  fTNodeY + (fB2 * fOffset)     x4 = fFNodeX + (fB1 * fOffset)     y4 = fFNodeY + (fB2 * 
  fOffset) 
  As always, any help would be greatly 
  appreciated… 
  Many thanks 
  Stu 
   
   
  Visit our website at http://www.halcrow.com
  The 
  contents of this email are confidential, for the sole useof the intended 
  recipient at the email address to which it hasbeen addressed and do not 
  give rise to any binding legalobligation upon Halcrow companies unless 
  subsequently confirmedon headed business notepaper sent by fax, letter or 
  as an emailattachment.  Whilst reasonable care has been taken to 
  avoid virustransmission, no responsibility for viruses is taken and it 
  isyour responsibility to carry out such checks as you 
  feelappropriate.  Emails supplied are as found and there's 
  noguarantee that the messages contained within the body of theemail 
  have not been edited after receipt. If you receive thisemail in error, 
  please contact the sender immediately and deletethe message from your 
  system.Thank 
  you.-
  
  

  ___MapInfo-L mailing 
  listMapInfo-L@lists.directionsmag.comhttp://www.directionsmag.com/mailman/listinfo/mapinfo-l
___
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l


RE: [MI-L] Problem with co-ordinates... Help please ???

2006-10-17 Thread Spencer Simpson
Title: Problem with co-ordinates... Help please ???








Analytic geometry methods only have a
chance of working if you use a projected coordinate system.  A conformal
projection (such as the British National Grid you're using) is preferred, if
you want vectors calculated from your coordinates to have a chance of
representing vectors on the Earth.  

 

If you're displaying the result data using
a different projection than the "current coordinate system" you were
calculating in, things may appear off anyway.

 

Even then, some things can bite you:

 

First of all, you have to make sure you've
set MapBasic's "current coordinate system" to the desired coordinate
system.  What values are you actually getting out of the calls to ObjectNodeX()
and ObjectNodeY()? (hint: Use print statements.)  If they're BNG
coordinates then you've done this correctly. If they're latitudes and longitudes,
[FA1, FA2] is not really a vector, fLinkLength isn't really a length, and [FB1,
FB2] isn't really a normal unit vector.  Set the "current coordinate
system" by issuing

 

Set Coordsys Table mytable

 

before you begin looping through mytable.

 

Secondly, if your bounds are too wide, then
the granularity of your space is too large, and when MapInfo knocks the
coordinates you calculate over to the corner of the nearest grid cell, the movement
may be large enough to see.  This will occur with very small widths and
can only be solved by using a coordinate system with tighter bounds.

 

Finally, if fOffset is large, fOffset*[FB1,
FB2] will never represent a vector normal to your line segment on the surface
of the Earth, because even a conformal projection represents angles correctly only
over short distances (actually 0, but they don't go far out of whack until the
distances get large).  The solution is to use spherical geometry to insert
several intermediate points, something that's probably too complicated to be
worth the effort.

 

Hope this helps

Spencer

 









From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gibb, Stuart
Sent: Monday, October 16, 2006
12:20 PM
To:
mapinfo-l@lists.directionsmag.com
Subject: [MI-L] Problem with
co-ordinates... Help please ???



 

 

All, 

I am using the following snippets of code to create fixed width
band regions at 90 degrees to a series of given straight lines. The lines
contain numerical data which I can then thematically map. I also have a version
that creates variable width bands but for the moment I'll assume all bands are
the same width.

After a lot of tweaking I thought I had finished the
tool...Unfortunately, after crudely holding the corner of a sheet of paper up
to the screen it appears my bands aren't perfectly perpendicular to the
original line though I am clueless as to what could have gone wrong…

Is there any error converting degrees to radians and then back
again in MapInfo ? Also, I am the using British national grid co-ordinate set,
could this where my slight discrepancy has come from multiplying ?

    fFNodeX = ObjectNodeX(oLine, 1, 1) ' read
longitude 
   
fFNodeY = ObjectNodeY(oLine, 1, 1) ' read latitude 
   
fTNodeX = ObjectNodeX(oLine, 1, k) ' read longitude 
   
fTNodeY = ObjectNodeY(oLine, 1, k) ' read latitude 

    fA1 = fTNodeX - fFNodeX 
   
fA2 = fTNodeY - fFNodeY 
   
fLinkLength = SQR(fA1*fA1 + fA2*fA2) 
   
fB1 = -fA2/fLinkLength 
   
fB2 = fA1/fLinkLength 

    x1 = fFNodeX + (fB1 *(fWidth + fOffset))

   
y1 = fFNodeY + (fB2 *(fWidth + fOffset)) 
   
x2 = fTNodeX + (fB1 *(fWidth + fOffset)) 
   
y2 = fTNodeY + (fB2 *(fWidth + fOffset)) 
   
x3 = fTNodeX + (fB1 * fOffset) 
   
y3 = fTNodeY + (fB2 * fOffset) 
   
x4 = fFNodeX + (fB1 * fOffset) 
   
y4 = fFNodeY + (fB2 * fOffset) 

As always, any help would be greatly appreciated…


Many thanks 

Stu 

 

 

 

Visit our
website at http://www.halcrow.com


The contents of this email are confidential, for the sole use
of the intended recipient at the email address to which it has
been addressed and do not give rise to any binding legal
obligation upon Halcrow companies unless subsequently confirmed
on headed business notepaper sent by fax, letter or as an email
attachment.  Whilst reasonable care has been taken to avoid virus
transmission, no responsibility for viruses is taken and it is
your responsibility to carry out such checks as you feel
appropriate.  Emails supplied are as found and there's no
guarantee that the messages contained within the body of the
email have not been edited after receipt. If you receive this
email in error, please contact the sender immediately and delete
the message from your system.
Thank you.
-






___
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l