Hello All,
I have a quick question concerning MapBasic, specifically using the CreatePoint function to create objects with UTM coordinates.
In this instance, I have a table that contains UTM coordinates for UTM 1983, Zone 16.
I have used the following code:
Create Map For POINT_X CoordSys Earth Projection 8, 74, "m",-81, 0, 0.9996, 500000, 0 Bounds (-7745844.29605, -9997964.94315) (8745844.29605, 9997964.94315)
Map From POINT_X
Update POINT_X set Obj = CreatePoint(UTM_EAST,UTM_NORTH)
Commit Table POINT_X
For whatever reason, the code doesn’t work correctly, and the points end up plotting on top of each other far removed from where they should be. To make matters worse, I can open the same table into MapInfo and manually use the Create Points menu item (using the UTM 1983 Zone 16 projection) and they plot out just fine.
Any ideas on this? Has anyone experienced a similar dilemma?
Thanks.
Mike Jenne
JCSI (Mapping/GIS/Site Intelligence for Wireless Telecommunications)
Trussville, Alabama
Uffe,
Thank you. I apologize for not checking the archives before posting. I will follow up on the archives now. Thanks again. I hope all is well with you.
Mike Jenne
<BR
Correct. I really enjoy the program, but I’m not a huge fan of the documentation.
Again, thank you for your kind and very timely assistance.
<BR
Here is some code
sub create_pnt
Dim x_1, y_1 As float
Dim win_id As Integer
Dim i_numrows_1 As SmallInt
' Open Table "M:\Mapdata\Building\Property_Hazards\lut_Item_Description.TAB" Interactive
'Set Map XY Units "m" CoordSys Earth Projection 18, 31, "m", 173, -41, 2510000, 6023150
'First, make sure the user didn't click in a Layout window.
win_id = FrontWindow()
If WindowInfo(win_id, WIN_INFO_TYPE) <> WIN_MAPPER Then
Note "You must click inside a MAP WINDOW."
Exit Sub
End If
' Retrieve the coordinates of the point where the user clicked.
x_1 = CommandInfo(CMD_INFO_X)
y_1 = CommandInfo(CMD_INFO_Y)
insert into hazards (obj)
values (createpoint(x_1,y_1))
i_numrows_1 = TableInfo("hazards", TAB_INFO_Nrows)
select * from hazards
where rowid = i_numrows_1
update selection
set X_Coord = x_1,
Y_Coord = y_1
call Dialog_screen
end sub
Regards,
Andrew Hare
GIS Administrator
Waimate District Council
Andrew,
Thanks much.
Mike Jenne
Was wrong when this happens
Icons change
Layer control disappears
Some layers disappear
Regards,
Andrew Hare
GIS Administrator
Waimate District Council