Creating points from .csv file problem

31 views
Skip to first unread message

Marijan

unread,
Aug 2, 2025, 1:24:19 PMAug 2
to MapInfo-L

I have a .csv file containing GPS readings, with Lat and Lon columns. I want to display these GPS points on a separate map, along with some other data.

I’ve added a new custom button to my ribbon that simply runs a MapBasic subroutine to create and show the GPS points. However, when I try to add these points, they end up plotted far from their expected positions.

My first guess was that some other tables with a different coordinate system (CRS) might be interfering. So I simplified my subroutine to just this part:


Register Table "C:\PathToCsvFile\GPS.csv" 
TYPE "ASCII" Delimiter 44 Titles Charset "WindowsLatin1" 
Into "C:\PathToTabFile\GpsPoints.TAB" 

Open Table "C:\PathToTabFile\GpsPoints.TAB"
 
Create Map For GpsPoints CoordSys Earth Projection 1, 104 

UPDATE GpsPoints Set Obj = CreatePoint(LatColumn, LonColumn) Commit Table GpsPoints 

Map From GpsPoints

But the problem persists.

Here’s the strange part: if I run this code manually in the MapBasic window, everything works fine. Also, if I create a test .mb file with just a Main subroutine containing this code, it works as expected.

So my suspicion is that something in my original MapBasic code (the one that sets up the ribbon and other tools) is causing this, but I can’t find what it might be. I’ve reviewed it and nothing stands out.

Any ideas what could be affecting the coordinate system or the map setup?

Marijan

unread,
Aug 2, 2025, 1:58:10 PMAug 2
to MapInfo-L
Found it: 
added line: Set CoordSys Earth Projection 1, 104 before making table mappable. 

This is incredible, I lost 2 days on this, but 1 minute after posting it here I found problem, and it's not first the time. From now on, I will post it first, then debug.

matt....@gmail.com

unread,
Aug 2, 2025, 3:54:36 PMAug 2
to mapi...@googlegroups.com
Rubber ducking is a valid debugging technique! 

Glad you got it sorted.


From: Marijan
Sent: Saturday 2 August 2025 18:58
To: MapInfo-L
Subject: [MI-L] Re: Creating points from .csv file problem

Found it: 
added line: Set CoordSys Earth Projection 1, 104 before making table mappable. 

This is incredible, I lost 2 days on this, but 1 minute after posting it here I found problem, and it's not first the time. From now on, I will post it first, then debug.
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
To unsubscribe from this group, go to:
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages