1

Is there a way in MapInfo Pro to automatically move a point dataset to the end points of a line that's within 50cm of a point?

This is an existing dataset so it's not simply turning on snapping. Ideally anything with an error above 50cm should be flagged for human modification.

I have tried the MapCAD tool set but can't get it to do this.

Near tool does this in ArcGIS and there's a partial solution in QGIS in Moving points onto lines (~neighborhood) and Snap points to line and calculate chainage using Open source GIS but I need to use MapInfo Pro for this project.

2

You can make use of the Distance Calculator tool to do this.

  • use the tool to calculate the distances between the point and line datasets and output the ID for each object
  • delete any records which have a distance greater than 50cm from the results table
  • create two new columns in your point table called X and Y (or something similar) of data type float
  • update your new X and Y columns from the distance calculator results table with the end point of the line (assuming you went from point to line, check the line direction first)
  • In MapBasic this would be:
  • Add Column PointTab (X) From DistCalcResults set to ObjectGeography(obj,3) where PointTab.ID = DistCalcResults.ID
  • Add Column PointTab (Y) From DistCalcResults set to ObjectGeography(obj,4) where PointTab.ID = DistCalcResults.ID
  • or you could use Table > Update Column and set the join in there

  • Finally, you just need to use Table > Create Points and specify your X and Y columns and to overwrite existing objects to create new points in the correct locations.

  • The workflow looks great. The issue is with step 1 (Distance Calc) where it's a manual process. I have thousands of data points to move. Is there some way to automate this? Importantly it should snap to the nearest end/start point of a line and not just the closest line. – GeorgeC Oct 13 '16 at 12:52
  • The Distance Calculator will work on the whole table at once so it's not really a 'manual' process (apart from setting it up initially). And if you are looking for the nearest start or end point only then it's probably best to convert the line objects into point objects (you can extract the coordinates with the ObjectGeography function) and then use the Nearest statement on a table of those points instead. – T_Bacon Oct 13 '16 at 15:16
  • PS: The source code for the Distance Calculator comes with MapBasic. It's basically using the Nearest statement – Peter Horsbøll Møller Aug 21 '17 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.