Extracting polygon attributes

53 views
Skip to first unread message

tpminer

unread,
Mar 16, 2007, 6:14:51 PM3/16/07
to MapInfo-L
I need to take all my polygon files and extract all the mappable
attributes. However, all of my polygons have no attributes - there is
only 1 collumn, all of the entry (several hundred) are zeroes.

How do I extract all the useful data that mapInfo uses into real
numbers that can then be used outside of the MapInfo environment? I'm
trying to compile all of our data into an MS Access database.

Thanks

Tom

Phil

unread,
Mar 18, 2007, 7:14:39 AM3/18/07
to MapInfo-L
Hi Tom,
I'm not quite sure why you'd want to move data from a GIS which is
designed for handling polygons to a database which isn't but never
mind...

In Mapinfo, you have data columns (like a database) plus an extra
invisible column called obj which contains the spatial information and
can be queried like any other. This is a bit of a simplification but
it will do. To do anything useful, you would need to write a program
in mapbasic (or mapxtreme) but you can get some idea from using the
mapbasic window in mapinfo.
For example ObjectInfo(obj,OBJ_INFO_NPOLYGONS) tells you how many
polygons make up an object, ObjectNodeX(obj,1,2) gives you the x co-
ordinate of the 2nd node of the first polygon in obj. After that, it
all gets complicated - what happens if there are multiple polygons to
an object - how do you tell if it's a hole or a polygon (hint:polygons
are clockwise, holes are anti-clockwise).

Anyway - hopefully this will give you some pointers as to where you
might start - or perhaps make you decide not to start at all!

Regards,
Phil
www.philallen.net


CB

unread,
Mar 18, 2007, 11:52:27 AM3/18/07
to MapInfo-L

As mentioned, there is a hidden 'obj' column. To use it, do something
like
Open table "myTable"
Fetch first from myTable
' myTable.obj represents the object in the first record in the
table

There are a number of MapBasic functions that will extract information
about objects -- ObjectInfo(), ObjectGeography(), Centroid(),
CentroidX(), CentroidY(), and others.

To learn more about how to extract detailed information about objects,
you might want to look at the MapBasic utility GELink.mbx,
specifically the subprocedure processDisaggTable() in module
gelink_ExportKML.mb. You can search for GELink on the MapInfo web
site.

Charles Bates
MapInfo Corp.

John Sanderson

unread,
Mar 19, 2007, 4:19:19 AM3/19/07
to MapInfo-L
A less complex answer would be to create a new column attached to the
polygon - e.g. 'Area' and then use Table>Update Column and use
'Assist' to define the Value:

Under the Function dropdown there are several spatial variables - e.g.
Area, Perimeter, etc.

A bit long winded if you have lots of polygons - but you can always
use the MapBasic window and copy and paste the commands if all the
polygons are similarly named...

Reply all
Reply to author
Forward
0 new messages