Hi Neil,
Yes, you can use the Update Column. First you may need to issue the following statement:
Set CoordSys Table PointsTab
This will ensure you are dealing with the correct coordinate system. Then, within the Value field of the Update Column dialogue, use the following:
If extracting X coordinates: CentroidX(obj)
If extracting Y coordinates: CentroidY(obj)
This will generate statements similar to the following:
Update PointsTab Set XCoord = CentroidX(obj) DropIndex Auto
Update PointsTab Set YCoord = CentroidY(obj) DropIndex Auto
(where "PointsTab" is the table you are updating, and "XCoord" and "YCoord" are the fields in your table).
This Update could be combined into a single statement in your workspace if you like:
Update PointsTab Set XCoord = CentroidX(obj), YCoord = CentroidY(obj)
------------------------------
James Nolet
Dooley Mitchell & Morrison Pty Ltd
Mentone, VIC, Australia
------------------------------
Original Message:
Sent: 01-31-2020 01:14
From: Neil Adamson
Subject: Longitudes and Latitudes
Hi All,
I have a points file and I would like to add Longitude and Latitude for each point. I realise I can use the coordinate extractor to do this. However....
I'm doing a number of different processing steps to create the data I want. I'm trying to write a MI workspace so that my processing is repeatable. I'm using the MapBasic window to capture the code and copy it into the workspace file I'm building.
If I use the coordinate extractor tool to populate the fields the code does NOT appear in the MapBasic window. Therefore, I cannot copy and paste it into my workspace file.
So, my question is...is there a way of adding fields for X and Y coords (and populating them) that will appear in the MapBasic window; so i can copy the code into my workspace.
Can I use the update column process? I had a look but couldn't find an option that would do what I want.
If this is the subject of another thread please point me in the right direction.
regards,
Neil
------------------------------
Neil Adamson
GIS Officer
Mitchell Shire Council
Broadford
------------------------------