Hi Jack -
Have you tried this:

Set Coordsys Table "KnownPositions"

instead of setting the coordsys from the window? If the projection of the 
window doesn't match the projection of the table into which you are 
inserting the point, the point may well be off the map.

Cheers,

Lindsay Giles
Senior GIS Analyst

AXYS Environmental Consulting Ltd
Suite 600-555 4th Ave. SW
Calgary, AB
T2P 3E7

e-mail:         [EMAIL PROTECTED]
Main Office:    403-269-5150
Direct Line:    403-750-7671
Fax:            403-269-5245
Visit our web site at http://www.axys.net




-----Original Message-----
From:   Jack MacDonald [SMTP:[EMAIL PROTECTED]]
Sent:   Monday, June 19, 2000 1:17 PM
To:     [EMAIL PROTECTED]
Subject:        MI Help with Coordinate system

My application in MapBasic 4.5 is driving me crazy, and
I would really appreciate some help. I am reasonably
certain the problem is with getting the correct
CoordSys, but after many hours, I still can't figure it
out.

The concept is that the user selects a point from the
SurveyedTrails table. I want to grab the XY coordinates
of the selected point, and create a new point in the
KnownLocations table using the same XY coordinates. The
new point is created when the user clicks a button in a
dialog box that Calls FixedPoint().


I have tried saving a Global oPoint object, saving the
XY coordinates in Global variables, and every other
combination that I can think of.

At first, the points were created at the wrong location,
now I can't find them at all.

Please help!


***********************
  global fEasting as float
  global fNorthing as float     
  global iHour as Integer
  global iMinute as Integer
  global iSecond as Integer
  global iNodeID as Integer
  global hWnd as Integer
  global oPoint as Object



sub FixedPoint
dim oNewPoint as object
        set coordsys window hWnd
        oNewPoint =
createPoint(centroidx(oPoint),centroidy(oPoint))
        Insert into KnownPositions (Obj, SampleSetID,
NodeID, Hour, Minute, Second)
                values (oNewPoint, iSampleSetID, iNodeID,
iHour, iMinute, iSecond)
end sub


sub SelChangedHandler
dim sTableName as string
dim iRow as Integer

        iRow = SelectionInfo(SEL_INFO_NROWS)
        If iRow <> 1 then
'               note "Wrong number of objects selected"
                exit sub
        end if
        sTableName = SelectionInfo(SEL_INFO_TABLENAME)  

        do case sTableName
          case "GPSSample"
                iHour = selection.hour
                iMinute = selection.minute
                iSecond = selection.second
                close table tableinfo(0,TAB_INFO_NAME)

          case "SurveyedTrails" 
                hWnd = frontwindow()
                set coordsys window hWnd
                oPoint = selection.obj

                fNorthing = selection.northing
                fEasting = selection.easting
                iNodeID = selection.nodeID      
                close table tableinfo(0,TAB_INFO_NAME)
                call CreateGPSTrailsDialog
          case else
'               print "neither of the two target tables"
        end case

end sub


         Jack MacDonald, Senior Researcher, Harvesting Operations
             Forest Engineering Research Institute of Canada
        Vancouver, BC Canada   (604) 228-1555   FAX (604) 228-0999



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

----------------------------------------------------------------------
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