Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

SQL Server shape field

196 views
Skip to first unread message

Sancarn

unread,
Aug 30, 2024, 5:57:49 AM8/30/24
to MapInfo-L
So I've just imported a microsoft sql server table into mapinfo, but unfortunately the SHAPE field (which stores the geometry) is coming through as a 254 character column, for instance:

346C000001040900000040E17A146ADA1841E0A3703D350D10415062105881DA18410064CC1D320D1041C0F5285C89DA1841A0703D0A310D1041D088D21E95DB1841E00DBE709B0D10419075719B99DB1841C0E1E9959B0D

I have reverse engineered this format before, but I figured there would probably be a better solution built into mapinfo? 

How can I setup my query such that MapInfo correctly picks up the obj geometry?


Sancarn

unread,
Aug 30, 2024, 6:05:48 AM8/30/24
to MapInfo-L
Looks like this user had the same issue... https://groups.google.com/g/mapinfo-l/c/RuezZYuPzwo/m/pyPOmjqoXXoJ

Unfortunately I can't make the table mappable. I assume because it's a linked table and therefore structure is pre-defined. Unfortunately I can't import it as a live table, because it has no primary key (for some reason...). That is out of my control unfortunately.

Peter Horsbøll Møller

unread,
Aug 30, 2024, 6:12:05 AM8/30/24
to mapi...@googlegroups.com

Hi

 

These articles may be of use:

Are you not able to create the MapCatalog in the database? That’s required for Pro to be able to register the table and see that it contains spatial data.

 

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Sancarn
Sent: 30. august 2024 12:06
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Re: SQL Server shape field

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/2003df63-0f18-4881-83a6-59705c8de3d9n%40googlegroups.com.

Sancarn

unread,
Aug 30, 2024, 7:49:32 AM8/30/24
to MapInfo-L
Hi Peter,

It doesn't appear as though the easy loader is creating the catalog (i followed the steps in 166 - the easy loader doesn't error but also doesn't display any field names:

Peter Horsbøll Møller

unread,
Aug 30, 2024, 9:26:52 AM8/30/24
to mapi...@googlegroups.com

Hi

 

Could it be an older version of EasyLoader where it just shows a list of tables registered?

Can you try to make a table mappable, that article 167.

 

If the catalog hasn’t been created, it could be that you don’t have enough permission to create the MapInfo schema and/or the MapCatalog table

Sancarn

unread,
Aug 30, 2024, 11:49:52 AM8/30/24
to MapInfo-L
Hi Peter,


I'm getting the following error messages:

ODBC Error: ODBC RC=-1, ODBC SQLState=42S02, DBMS RC=208, DBMS Msg=[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'MAPINFO.MAPINFO_MAPCATALOG'..

The table you have chosen cannot be made mappable.  To be made mappable, a table must contain a spatial column, or at least two numeric columns.

Sancarn

unread,
Aug 30, 2024, 11:52:59 AM8/30/24
to MapInfo-L
> If the catalog hasn’t been created, it could be that you don’t have enough permission to create the MapInfo schema and/or the MapCatalog table

This is most certainly possible, the database user we have has read-only access to the database. Do you need to have write access to the database?

Peter Horsbøll Møller

unread,
Sep 2, 2024, 1:58:30 AM9/2/24
to mapi...@googlegroups.com

Yes, the user who creates the MapInfo Catalog and who makes the tables mappable need write access to the database.

The user who create the MapCatalog need permissions at a DBO or DBADMIN level as it involves creating a schema and a table.

 

Maye you can ask your DBO to create the catalog for you?

He can create it manually in the database too, see: https://help.precisely.com/r/MapInfo-Pro/2023/en-US/MapInfo-Pro-Help/Useful-Tables-and-Information/Data-and-Settings-Management/Sample-Data-Provided-for-Microsoft-Access-Support

Sancarn

unread,
Sep 2, 2024, 11:12:21 AM9/2/24
to MapInfo-L
I assume there is no way to use an external catalog? 😅 I think our DBO will refuse... We struggle to get fields added to the database in question unfortunately.

I'll probably end up reversing the shape field in MapBasic. Only get 254 bytes of data which isn't great though haha 

Sancarn

unread,
Sep 2, 2024, 12:25:08 PM9/2/24
to MapInfo-L
In my particular case actually I don't necessarily need the shape, a centroid will do. I can register each of my tables to get the XY:

Server Link Table "select *,SHAPE.STEnvelope().STCentroid().STX as X,SHAPE.STEnvelope().STCentroid().STY as Y From ..." Using ...

Can I make these mapable from the X/Y coordinates without edit access to the database? Or will I need to commit a read-write copy of the table to disk first before making them mapable?

Peter Horsbøll Møller

unread,
Sep 3, 2024, 1:36:37 AM9/3/24
to mapi...@googlegroups.com

Hi

I have never tried creating points for a not-mappable server table.

I’d think you would have to unlink the linked table to be able to create points.

Peter Horsbøll Møller

unread,
Dec 11, 2024, 4:51:06 AM12/11/24
to mapi...@googlegroups.com

Maybe the upcoming MapInfo Pro v2023.1 can be of help to you.

We have made some great improvements when it comes to working with spatial databases.

 

One of these is that the MapInfo Map Catalog will be optional moving forward.

We can detect the spatial data types from the table itself.

 

More to come soon on this new release.

 

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: Peter Horsbøll Møller
Sent: 2. september 2024 07:58
To: mapi...@googlegroups.com
Subject: RE: [MI-L] Re: SQL Server shape field

 

Yes, the user who creates the MapInfo Catalog and who makes the tables mappable need write access to the database.

The user who create the MapCatalog need permissions at a DBO or DBADMIN level as it involves creating a schema and a table.

 

Maye you can ask your DBO to create the catalog for you?

He can create it manually in the database too, see: https://help.precisely.com/r/MapInfo-Pro/2023/en-US/MapInfo-Pro-Help/Useful-Tables-and-Information/Data-and-Settings-Management/Sample-Data-Provided-for-Microsoft-Access-Support

 

Peter

 

Reply all
Reply to author
Forward
0 new messages