Hi all,

Some weeks ago I raised the question what is the best way to change a group
of points into a region. I received a lot of suggestions, which I will list
over here. Thanks to everybody who responded. If somebody is interested in
more advise or e-mail adress from people who helped me, let me know.

As in my case all points were situated in a regular grid, where the distance
between the points was a known fixed value, I solved the problem by changing
the point object into square objects, and then combine these objects. Robert
Crossley helped me with that.

Another way is to make a region object using the points as nodes for the
border of this region. This works fine as long as the points in the
collection are all situated at the border, and not in the middle of the
region.
Jon Spinney send an .mbx which performed this, Trey Pattillo send the
following example for a script:

Select * from MyTable into Work
'or Select * from MyTable where CONDITION into Work
 DIM aReg as object
DIM aObj as object
DIM aNode as integer
aNode=1 'set initial as node number 1
Create Region Into Variable aReg 0 'create a blank region
Fetch First From Work
While NOT EOT(Work)
         aObj=Work.Obj   '''''get point object
        Alter Object aReg Node Add Position 1, 
        aNode ( CentroidX(aObj), CentroidY(aObj) ) '''''add node
        aNode=aNode+1 '''''increment node number
        Fetch Next From Work     
Wend
Fetch First From Work
aObj=Work.Obj
Alter Object aReg Node Add Position 1, aNode ( CentroidX(aObj),
CentroidY(aObj) ) 
insert into Work (obj) Values (aReg)

John Chioles and Eric Maranne  suggested to use the grid topology from the
SW->NW->NE->SE->SW corners, when the grid is rectangular.
John gave the following code:
'long./lat. as Cartesian
for j = 1 to giCellsY ' y loops South to North
        fTmpMinY = fMinY + (gfSpacingY * (j-1)) 
        fTmpMaxY = fMinY + (gfSpacingY * (j)
        for i = 1 to giCellsX 
                fTmpMinX = fMinx + (gfSpacingX * (i-1)) 
                fTmpMaxX = fMinX + (gfSpacingX * (i) )  
                'create lines in clockwise fashion starting w/ SW corner
                insert into GridLines (obj)
                values (createline( fTmpMinX, fTmpMinY, fTmpMinX,fTmpMaxY ))
'SW
                insert into GridLines (obj) 
                values (createline( fTmpMinX, fTmpMaxY, fTmpMaxX,fTmpMaxY))
'NW
                insert into GridLines (obj) 
                values (createline( fTmpMaxX, fTmpMaxY, fTmpMaxX,fTmpMinY ))
'NE
                insert into GridLines (obj)
                values (createline( fTmpMaxX, fTmpMinY, fTmpMinX,fTmpMinY
))' SE
        next
next

Furthermore Robert Louer advised me the following:
The answer would be that you need a convex hull algorithm  to perform this.
There's
a simple convex hull application written in mapbasic on the listserver
(http://www.directionsmag.com/mapinfo-l/IndexFiles.htm):
Convex hull 
Minimum bounding circle, compactness 
hull.exe * 
Calculates the convex hull and minimum bounding circle for a set of points.

On al large dataset of points this is not very fast. Right now InterStation
is working on a DLL version of the algorithm which will be very fast. This
DLL can be called from within mapbasic to perform the task. The tool will be
finished in january. Also there are several applications where you could do
the same, for instance Vertical Mapper has a convec hull calculation in
their grid application

Steve Thompson wrote:
Carla: You can either purchase our Poly Id application which will build
regular, convex or concave polygons around points or we can do it for you as
a service.  PolyID is an add on tool to MapInfo.  It is a C++ exe called by
a MapBasic program.  It costs USD$995.  It has been tested with ups to 2.5
million points.  You can specify a column in a database to it too so it will
draw unique polygons for each dataset.  Our minimum service charge is $500.
Or $1 per polygon which ever is greater.  I don't think you will find you
can make a MapBasic program work for any more than a few points.
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to