Hi Graham, Jacques

You dont need to use the ObjectNodeX and ObjectNodeY functions, just use
the ExtractNodes() function see the exampel below


dim testobj, nytobj as object,
    i,ii, NRec, NPoly as smallint,
    NNodes as integer,
    tabnavn as string,
    aObj as alias

tabnavn = "dummy"
aObj    = tabnavn + ".OBJ"
NRec   = tableinfo(tabnavn, tab_info_nrows)

for i = 1 to NRec
    fetch rec i from tabnavn
    testobj = aobj
    NPoly   = objectinfo(testobj, OBJ_INFO_NPOLYGONS)
    If NPoly > 1 then
       For ii = 1 to NPoly
           NNodes = objectinfo(testobj, (OBJ_INFO_NPOLYGONS + ii))
           Nytobj = ExtractNodes(testobj, ii, 1, NNodes, True)
           Insert into f_delt(obj, id) Values (nytobj, i)
        Next
     else
       Insert into f_delt(obj, id) Values (testobj, i)
    end if
next

Peter Laulund
National Survey and Cadastre, Denmark




"Jacques Paris" <[EMAIL PROTECTED]> - 01-08-99 02:23:03

Til:    "Graham Smith" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
cc:      (bcc: Peter Laulund/MI/KMS)
Vedrørende:    RE: MI Splitting polygons



objectinfo(obj,21) or ...,obj_info_npolygons) yields the number of polygons
for the object.

e.g. if you
    select * from your_table where objectinfo(obj,21)>1 into selec
you will get the table "selec" with all your multi-polygons regions
(records)

To "explode" those regions you have to write an iterative program, going
through each region and for each one reading the required info with
    objectinfo(obj,21+poly_num) to get the number of nodes in each polygon
abd
    objectnodeX(obj,poly_num,node_num) and objectnodeY(..) for each node
coordinates
then create a single-polygon region with these nodes.

A rather straight forward progam! Good luck.

Jacques Paris
============================================================
e-mail        [EMAIL PROTECTED]
   alternate   [EMAIL PROTECTED]

gis activity (MapInfo mainly)
      http://www.total.net/~rparis/gisproducts.htm
============================================================
    -----Original Message-----
    From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Graham Smith
    Sent: July 31, 1999 10:54 AM
    To: [EMAIL PROTECTED]
    Subject: MI Splitting polygons


    Hi everyone,

    I have a MapInfo layer containing a large number of records. Most of
the
records are single geometric shapes (polygons), but some are comprised of
geographically separate polygons that have been combined into a single
record. I need to be able to split these combined polygons so that in the
resulting table every record in the table represents a single geometric
shape (polygon).

    Does anyone know how this can be done automatically using mapbasic?  I
know that it can be done interactively, by drawing a shape around a polygon
in the cosmetic layer and using the "Split" command, but I have around
50,000 records in the table and it would take forever to do this manually.
Is there some way of identifying from the .MAP file whether a record
consists of more than one polygon?


    Graham Smith
    [EMAIL PROTECTED]





objectinfo(obj,21) or ...,obj_info_npolygons) yields the number of polygons for the object.
 
e.g. if you
    select * from your_table where objectinfo(obj,21)>1 into selec
you will get the table "selec" with all your multi-polygons regions (records)
 
To "explode" those regions you have to write an iterative program, going through each region and for each one reading the required info with
    objectinfo(obj,21+poly_num) to get the number of nodes in each polygon abd
    objectnodeX(obj,poly_num,node_num) and objectnodeY(..) for each node coordinates
then create a single-polygon region with these nodes.
 
A rather straight forward progam! Good luck.
 
Jacques Paris
============================================================
e-mail        [EMAIL PROTECTED]   
   alternate   [EMAIL PROTECTED]
 
gis activity (MapInfo mainly)
      http://www.total.net/~rparis/gisproducts.htm
============================================================
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Graham Smith
Sent: July 31, 1999 10:54 AM
To: [EMAIL PROTECTED]
Subject: MI Splitting polygons

Hi everyone,
 
I have a MapInfo layer containing a large number of records. Most of the records are single geometric shapes (polygons), but some are comprised of geographically separate polygons that have been combined into a single record. I need to be able to split these combined polygons so that in the resulting table every record in the table represents a single geometric shape (polygon).
 
Does anyone know how this can be done automatically using mapbasic?  I know that it can be done interactively, by drawing a shape around a polygon in the cosmetic layer and using the "Split" command, but I have around 50,000 records in the table and it would take forever to do this manually. Is there some way of identifying from the .MAP file whether a record consists of more than one polygon?
 

Graham Smith
[EMAIL PROTECTED]
 
 
 
 

Reply via email to