split tab into multiple files each containing a single feature.

1,087 views
Skip to first unread message

GISRS

unread,
Jun 29, 2011, 4:30:01 AM6/29/11
to MapInfo-L
Is there a way to automate splitting a tab file with multiple point
features into a series of tab files each containing 1 point with
incremental numeric file names.

eg. I have a layer containing 10,000 points, what i really could do
with is 10,000 tab files each with a single point named eg. point_1,
point_2, point_3...

The reason being i need the points individually in order to automate a
processing routine i'm making in Grass.

zer...@gmail.com

unread,
Jun 29, 2011, 4:42:59 AM6/29/11
to MapInfo-L
Yes there is, unfortunately I can't share you the tools right now, I'm not using my laptop. If you could wait a few hours than I will share it. But if not, I hope someone can help you fast.

Regards,
Zery
Sent from my BlackBerry®
powered by Sinyal Kuat INDOSAT
--
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

GISRS

unread,
Jun 29, 2011, 4:52:40 AM6/29/11
to MapInfo-L
Zery thanks for the fast reply if you could share those later you'd be
a lifesaver.

Mats Elfström

unread,
Jun 29, 2011, 5:04:16 AM6/29/11
to mapi...@googlegroups.com
Hi!
If your numbers are right, 10000 tab files would make 50000 very small files in all, enough to bog down any file server or hard drive.
It is simply bad practice if I may say so. If your routine can read one tab file, why can't it read more than one object?
You need to think one step further.
Now I know that some will criticize me for not responding to the question, but I want to save you from extra work that probably will cause more trouble than it saves.

Regards, Mats.E

2011/6/29 GISRS <gi...@live.co.uk>



--
______________________________________________
Mats Elfström, Väpplingvägen 21, SE-227 38 LUND, Sweden
tel: +46 46 145959 / mob: +46 70 595 39 35
alt e-mail: mats.e...@telia.com


GISRS

unread,
Jun 29, 2011, 5:06:29 AM6/29/11
to MapInfo-L
just reread my first post and realised somethings not all that clear

once the files are split i'd need separate files named point_1.tab,
point_2.tab, point_3.tab...

GISRS

unread,
Jun 29, 2011, 5:34:42 AM6/29/11
to MapInfo-L
Mats,

Thanks for the reply I know this isn't the ideal solution but i
thought i'd give it a try after trying a few other methods. I'm fairly
new to grass and the only way i can see to achieve what i need is to
do it this way.

The task involves using a DTM and a series of manholes and finding the
flow route water would take if any of the manholes were to spill /
overflow. the only options in grass were to enter individual xy
coordinate pairs or specify a file with multiple points.

i've found i can throw about 1000 points at grass using this routine
at a time however the problem with this is that you end up with the
water flow routes from upstream manholes merging with the downstream
ones which messes up the next stage of our planned processing routine
which assesses the number of properties at risk downflow of the
manhole.

my next plan was to run each routine separately with a single manhole
and use the model builder and some python scripting to loop the
process. I know there should be a way to use one file and work through
it as separate runs but i haven't found a way yet but i'll keep
looking.

Andy Harfoot

unread,
Jun 29, 2011, 9:11:44 AM6/29/11
to mapi...@googlegroups.com
Hi there,

I assume you are using the r.drain module of GRASS. If so, then you can call the module with the individual XY coordinates of a point. If as you say you want to batch the processing of your 10000 points, then the batch script would be able to make the repeated calls to r.drain, substituting a new pair of coordinates each time. This way, all you need is a a list of coordinates that the batch script could read - probably a delimited text file, which could be generated from your MapInfo table by using the Coordinate Extractor tool to create and populate X and Y columns and then Exporting the result. No need to subset the MapInfo table.

Andy
-- 
Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel:  +44 (0)23 8059 2719
Fax:  +44 (0)23 8059 2849

www.geodata.soton.ac.uk

---------------------------------------
For further information about GeoData's
Training Courses, please visit:
           www.gis-train.com
---------------------------------------

zer...@gmail.com

unread,
Jun 29, 2011, 9:29:28 AM6/29/11
to MapInfo-L
Hi,

In case you still need it, I have just updated the tool at www.mapinfotools.com, the tools now has the ability to add a prefix or suffix name of your splited table.

http://www.mapinfotools.com/index.php?option=com_sobi2&sobi2Task=sobi2Details&catid=4&sobi2Id=455&Itemid=72

To do what you need, first you have to add a new column to your table, then update the new column with rowid statement, so you'll get all of your points numbered from 1 to n.

Using the tool, select your table and column that become the source to split (in this case your new column), then choose prefix on the radio group and fiil in the word point to the edit column next to it. You will get your new generated tables name point_1.tab, point_2.tab...point_n.tab.

HTH,

GISRS

unread,
Jun 29, 2011, 9:54:20 AM6/29/11
to MapInfo-L
Zery that's exactly what I was after thank you so much for your help.

For reference if any one else needs to use the tool the ID (rowid)
column needs to be a character field

David Reid

unread,
Jun 29, 2011, 10:23:53 AM6/29/11
to mapi...@googlegroups.com
FWIW, and for those new to Mapinfo in the future who may find this thread in
the archives... Mats warning about the 50,000 files carries a great deal of
merit.

Bare in mind that normal MI tables *TAB files* require at least three other
files, .MAP=contains mapping objects, .DAT=the data you see in your browser,
.ID=links the objects in MAP to the lines of data in DAT for a total of four
files for one table.

If you have even a single column of your table indexed, there will be a
fifth file, .IND=the index.

Hence, for 10,000 TAB files, you will have a total between 40k to 50k files
created which as Mats points out, could easily clog up one's server, or more
noticably, could choke one's HDD. (of course, with terabyte HDD getting
cheaper everyday, I suppose the latter may be a non issue but could still
cause issues).

Not trying to discourage, just thinking outside the box.

David Reid


----- Original Message -----
From: "GISRS" <gi...@live.co.uk>
To: "MapInfo-L" <mapi...@googlegroups.com>
Sent: Wednesday, June 29, 2011 8:54 AM
Subject: [MI-L] Re: split tab into multiple files each containing a single
feature.

Zery that's exactly what I was after thank you so much for your help.

For reference if any one else needs to use the tool the ID (rowid)
column needs to be a character field

--

Cinda Graubard

unread,
Jun 29, 2011, 10:52:38 AM6/29/11
to mapi...@googlegroups.com
I don' know how this would handle that many tables, but if you have
Discover it splits tables based on an attritute with the ability to name
the output table by conventions, including the attribute group. It is
part of Discover>Data Utilities>Table Split. I use it all the time, it
works very well, is very convenient. You could split on the basis of a
rowid for example. My only uncertainty is how it might work on such a
large number.

Cinda Graubard

GeoMax
GIS and 3D Modeling for Mineral Exploration
Analysis, Integration, Visualization
Training, Support, Sales

Uffe Kousgaard

unread,
Jun 29, 2011, 11:16:23 AM6/29/11
to mapi...@googlegroups.com
Just remember this is only an issue if all the files are in one folder.

I just did a count (not by hand!) and have almost 270,000 files on the
C-partition alone. No issue at all and the D and E-partitions have many
files too.

Regards
Uffe Kousgaard


David Reid wrote:
> Hence, for 10,000 TAB files, you will have a total between 40k to 50k files
> created which as Mats points out, could easily clog up one's server, or more
> noticably, could choke one's HDD. (of course, with terabyte HDD getting
> cheaper everyday, I suppose the latter may be a non issue but could still
> cause issues).
>

> David Reid
>
>

Treichel, Kent (MDOR)

unread,
Jun 29, 2011, 11:25:59 AM6/29/11
to mapi...@googlegroups.com
What about using qik_subset.mbx? Select a column with a unique attribute and it saves each query to its own table.

Regards
Uffe Kousgaard

--

GISRS

unread,
Jun 29, 2011, 11:52:04 AM6/29/11
to MapInfo-L
I've split my file using Zery's tool worked perfectly created 10300
files in about 10 minutes though i'm not going to have time to see how
well the files process in grass until next week now i shouldn't think.

zer...@gmail.com

unread,
Jun 29, 2011, 7:09:57 PM6/29/11
to MapInfo-L
Actually, this tool is my version of qik_subset or discover split table. It's main purpose is to split a table by atribute, there's a lot of this kind of tool on the net, but to fulfill what I need so I build it with an extra column (not just split based on one column but with two column and an extra prefix/suffix name), now I'm thinking to add more extra like the ability to change the directory of the new file created and a progress bar. I never think or considered how can this tool handle a task with a big split, glad to hear that it works :D

Regards,
Zery
Sent from my BlackBerry®
powered by Sinyal Kuat INDOSAT

-----Original Message-----
From: GISRS <gi...@live.co.uk>
Sender: mapi...@googlegroups.com
Date: Wed, 29 Jun 2011 08:52:04
To: MapInfo-L<mapi...@googlegroups.com>
Reply-To: mapi...@googlegroups.com

harki....@gmail.com

unread,
Jun 22, 2015, 4:46:00 PM6/22/15
to mapi...@googlegroups.com, zer...@gmail.com
Hello Zery,
 
I downloaded the zip file but I am unable to run it on MapInfo 12.0 version.  Am I missing something?
 
Thanks,
 
Harki

Zery

unread,
Jun 22, 2015, 5:16:41 PM6/22/15
to harki....@gmail.com, MapInfo-L

Please make sure your column to split is in character type. It is only works in character right now.

Thank you.

Reply all
Reply to author
Forward
0 new messages