MapInfo Pro

 View Only
  • 1.  MapInfo Monday: Creating the MapInfo MapCatalog in a spatial database

    Employee
    Posted 01-15-2024 03:35
    Edited by Peter Møller 01-15-2024 03:36

    Happy #MapInfoMonday!

    We did in an earlier post look into connecting to a (spatial) database using ODBC from MapInfo Pro. In this article, we will take the use of a spatial database from MapInfo Pro a bit further.

    Before MapInfo Pro can take advantage of spatial data in a (spatial) database, it needs a MapInfo MapCatalog in the database. This catalog holds information about the spatial data in the tables you want to use in MapInfo Pro. This can be details like the coordinate system, the type of spatial data, how to style the data when viewed in MapInfo Pro, the spatial extent of the data, and a few more details.

    These details are stored in the MapInfo_MapCatalog table under the MapInfo schema in the database. The MapInfo_MapCatalog table has these columns for storing this information:

    • SPATIALTYPE FLOAT
    • TABLENAME CHAR(32)
    • OWNERNAME CHAR(32)
    • SPATIALCOLUMN CHAR(32)
    • DB_X_LL FLOAT
    • DB_Y_LL FLOAT
    • DB_X_UR FLOAT
    • DB_Y_UR FLOAT
    • VIEW_X_LL FLOAT
    • VIEW_Y_LL FLOAT
    • VIEW_X_UR FLOAT
    • VIEW_Y_UR FLOAT
    • COORDINATESYSTEM CHAR(254)
    • SYMBOL CHAR(254)
    • XCOLUMNNAME CHAR(32)
    • YCOLUMNNAME CHAR(32)
    • RENDITIONTYPE INTEGER
    • RENDITIONCOLUMN CHAR(32)
    • RENDITIONTABLE CHAR(32)
    • NUMBER_ROWS INTEGER

    The specific column type may differ from database to database.

    As the MapCatalog has to be created under the MapInfo schema, you will need to have some elevated permission on the database to create the MapCatalog. In PostgreSQL, you will at least need the CREATE privilege for the current database. For SQL Server you will need the CREATE permission which typically will be included in the db_ddladminrole and also in the db_owner role.

    Creating the MapCatalog with MapInfo EasyLoader

    If your spatial database doesn'øt have the MapCatalog, you will have to create it. That's done very easily with MapInfo EasyLoader. MapInfo EasyLoader is an add-on for MapInfo Pro that can help you upload tables to a spatial database. MapInfo EasyLoader is also a stand-alone application that can be used without MapInfo Pro to upload MapInfo tables.

    From the Tools window, ensure that MapInfo EasyLoader has been loaded from the Registered tab. If you use it a lot, consider checking the AutoLoad option to have MapInfo Pro load it automatically on start.

    Now double-click on MapInfo EasyLoader in the Running tab, or right-click and click on MapInfo EasyLoader.
    The MapInfo EasyLoader dialog will now get loaded.
    If this is the first time, you use MapInfo EasyLoader, you will first have to create a new database connection. From the Database Connection dropdown, select <New Connection> and now click on the Manage Connection List control to the right of the list. You can also use this to create another connection in case you have multiple spatial databases.
    This will open the Database Connection dialog where you can create your new connection. 
    You will need to give the connection a name and select the type of connection. Oracle is disabled for me as I don't have any Oracle client installed.
    I select ODBC as the Connection Type, and then I click on the button next to the DSN Name to select my data source. This will bring up the Select Data Source dialog allowing me to either create a new data source or select an existing one. I switch to the Machine Data Source tab and select my data source from the list.
    With a name specified and a data source selected, I can now click on the OK button back in the Database Connection dialog to create a new connection for MapInfo EasyLoader.
    Back in the MapInfo EasyLoader dialog, I ensure that the right connection has been selected from the Database Connection list. The next step is to create the MapInfo_MapCatalog table in the database. To do this, I click on the Map Catalog button.
    If the MapInfo_MapCatalog table doesn't exist, it will now get created. The same will happen to the MapInfo schema if this doesn't exist. You will get an error here if you are allowed to perform one of these tasks on the selected database.
    If this succeeds, the MapInfo Map Catalog dialog will be shown. If the table didn't exist, the dialog will not hold any records. If the MapCatalog table already existed, you may see some existing records listed.
    Now the MapInfo_MapCatalog has been created in the database and you can register spatial tables in the catalog. You can register existing spatial tables using the Make DBMS Table Mappable control on the Table tab. If you upload new tables using MapInfo EasyLoader or via Save Copy As through MapInfo Pro, the tables will automatically get added to the Map Catalog in the database.
    Besides creating the Map Catalog, you can as I alluded to above, also use MapInfo EasyLoader to upload existing native tables into your database. This can be done through the MapInfo EasyLoader dialog or you can use the batch approach through batch files.
    If you prefer, you can also manually create the MapCatalog in your database. We will not cover this in this article.
    Learn more about MapInfo EasyLoader in the PDF document that comes with MapInfo EasyLoader or in the MapInfo EasyLoader v2023 help on the Precisely Help Center.



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 2.  RE: MapInfo Monday: Creating the MapInfo MapCatalog in a spatial database

    Posted 11 days ago

    This is an excellent article, Thanks for that! I found few tables in our SQL Server spatial database which are not registered under MAPINFO_MAPCATALOG. Hence, I'm unable to add them to MapInfo. Is there a way I can register existing spatial tables with the MAPINFO_MAPCATALOG using Mapinfo Pro?



    ------------------------------
    Thanks & Regards
    Dhan
    VIC, Australia
    ------------------------------



  • 3.  RE: MapInfo Monday: Creating the MapInfo MapCatalog in a spatial database

    Employee
    Posted 11 days ago

    Sure, use Make DBMS Table Mappable.

    More information in this article: MapInfo Monday: Making DBMS Tables Mappable



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 4.  RE: MapInfo Monday: Creating the MapInfo MapCatalog in a spatial database

    Posted 11 days ago
    Edited by Martin Thorn 10 days ago

    Good article, we have been using this option for a while now and thinking about refining the database a bit so you get a relational database, not just standalone tables.

    So I wonder what would be the best option and if you could set it up the relation somehow in MapInfo (or Easyloader?) and then upload the whole database, or if you have to set it up in SQL Server Management Studio (SSMS)or whatever database you use.

    I figured if you have a lot of common attributes on all features that belong to a facility for example, you only want to add common data once for all features in the facility (polygons, points,lines) and all the objekts in that facility should be updated. Also the features has some uniqe attributes that is not common for the whole facility. 

    Like you can do in a Geodatabase for example I know mapifo tab format can have points lines and polygons in the same, not recomended by some? but then I guess all fields will be similar for the different features and I still think the data is not updated for all objects, (ie a point has its table row, the polygon has its and the line has its row.)



    ------------------------------
    Martin Thorn
    GIS Ingenjör
    Göteborgs Stad
    GOETEBORG
    ------------------------------