Jamie, Mapinfo's internal workings rely on knowing what projection is being used at anyone time and when you run a mapbasic program it defaults to Mapinfos core projection of lat long. You have to issue a 'set coordsys' command within the Mapbasic application prior to any commands where spatial calculation is needed. you can either use the
set coordsys table MYTABNAME approach, or if you are only providing tools to UK users you can use the standard Coordsys clause for the UK Set CoordSys Earth Projection 8, 79, "m", -2, 49, 0.9996012717, 400000, -100000 dont forget that if your prog is used with maps of other projection (or layouts that have a non-earth proj) then you need to issue the command to reset the working projections as you switch from Mapper to mapper (or layout)... this has tripped me up several times..(apologies to those overseas users of qik_capture whose point data refuses to plot anywhere other than UK!!) hth R -----Original Message----- From: Dowdall, Jamie J [mailto:[EMAIL PROTECTED] Sent: 20 May 2004 11:18 To: '[EMAIL PROTECTED]' Subject: MI-L Coordsys Mapbasic Problem Hi All I have a mapbasic program that uses the distance function in a query to join two tables and list the distances between the two sets of eastings and northings. I first wrote the code in Mapbasic window in mapinfo and pasted into mapbasic,( in mapinfo) this did not work correctly (incorrect distance values)at first until I set the coordsys of one of the tables before executing the query again. In the mapbasic window (in mapinfo) I wrote the following two lines of code Set coordsy table "table1" Select table1.shopname,table2.shopname, Distance(table1.x,table1.y,table2.x,table2.y,"Mi")where table1.link = table2.link into selection Browse * from selection Upon running this in the mapbasic window (in mapinfo) line by line it worked correctly And a browser was produced with the distances correctly measured. I pasted this code into Mapbasic and compiled without errors I had to change the statement a little to run the sql Set coordsys table "table" S = Select etc etc Run command S But once run as a program, the results did not work from MapBasic. The browser appears but the distance values are all zeros. If then I go into Mapbasic window in mapinfo and write Set coordsys table "table1" And press enter an hour glass appears then the browser that was previously open updates with the correct distances. Why is exactly the same code not working in mapbasic but works in the mapbasic window in mapinfo.. Hope somebody can please help. I feel like I am going round in circles Thanks Jamie This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding. --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 11855 ********************************************************************* This e-mail message, and any files transmitted with it, are confidential and intended solely for the use of the addressee. If this message was not addressed to you, you have received it in error and any copying, distribution or other use of any part of it is strictly prohibited. Any views or opinions presented are solely those of the sender and do not necessarily represent those of the British Geological Survey. The security of e-mail communication cannot be guaranteed and the BGS accepts no liability for claims arising as a result of the use of this medium to transmit messages from or to the BGS. . http://www.bgs.ac.uk ********************************************************************* --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 11856
