Hi Deepak
Most of what you describe can be done using MapBasic and/or Python in MapInfo Pro.
A few follow-up questions:
- When you say shapefile, do you mean an ESRI shapefile or is that a general reference to a file holding spatial objects (shapes)?
- How are these files stored on the server? This is important when understanding how you can access the files programmatically.
- I haven't encountered the GDL format before. It could be this format, but I'm unsure: "The GDL file is an ArchiCAD Geometric Description Language File. ArchiCAD is an architectural CAD software developed by the Hungarian company Graphisoft." I am also not sure how you can convert this format.
A couple of suggestions to get you started:
If you are looking to open ESRI shapefiles in MapInfo Pro, you can use the Register Table command to create a TAB file referencing the ESRI shapefile and then use Open Table to open the ESRI shapefile in MapInfo Pro. Finally, you can save a copy of the shapefile into a native TAB file for read/write access using the Commit Table statement.
'**Creating a few variables for the script
Dim arrShapeFiles(0), sShapeTabFile, sNativeTabFile As String
Dim sShapeTab, sNativeTab As String
Dim nFile As Integer
'**Defining the list of Shape Files to open using a String array
Dim nFile As Integer
nFile = nFile + 1
ReDim arrShapeFiles(nFile)
arrsShapeFiles(nFile) = "C.\Data\SomeShapeFile1.shp"
nFile = nFile + 1
ReDim arrShapeFiles(nFile)
arrsShapeFiles(nFile) = "C.\Data\SomeShapeFile2.shp"
nFile = nFile + 1
ReDim arrShapeFiles(nFile)
arrsShapeFiles(nFile) = "C.\Data\SomeShapeFile3.shp"
'**Opening an ESRI Shapefile and saving it into a Native Tab File
sNativeTabFile = "C.\Data\SomeNativeTabFile.tab"
Register Table arrShapeFiles(1) Type SHAPEFILE Charset "WindowLatin1" CoordSys Auto PersistentCache ON Type NATIVEX Into sShapeTabFile
Open Table sShapeTabFile
sShapeTab = PathToTableName$(sShapeTabFile)
Commit Table sShapeTab As sNativeTabFile
Close Table sShapeTab
Open Table sNativeTabFile
sNativeTab = PathToTableName$(sNativeTabFile)
If you want to add more tables into the same file, you can use the Insert statement to merge two tables. In the example below, I use the For loop to loop over the shapefiles in the array arrShapeFiles.
'**Looping over the files 2 to number of files, opening each and inserting the rows into the native table
For nFile = 2 To Ubound(arrShapeFiles
Register Table arrShapeFiles(nFile) Type SHAPEFILE Charset "WindowLatin1" CoordSys Auto PersistentCache ON Type NATIVEX Into sShapeTabFile
Open Table sShapeTabFile
sShapeTab = PathToTableName$(sShapeTabFile)
Insert Into sNativeTab
Select * From sShapeTab
Commit Table sNativeTab
Next
Hopefully, this can get you started. Feel free to come back with follow-up questions.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------