/*Hi Armando and Moshe,
Thanks both. Unfortunately I do not have the desired results yet.
Armando, I have modified the macro as follows, and it compiles but does
not run, apparently there is a problem with the layer name I can not
solve. Long time since I last use this kind of stuff and as you know I
am not a programmer myself, just let's say skilled user. It is a pity
because I believe that your macro provides exactly what I need, that is
a list of all the polygons in the geographic file with the corresponding
perimeter, I will need the area as well, but that I can generate
directly from Mapt dataview.
On the other hand, Mohe's Dialog box runs smoothly, but the results are
not what I need.
Cheers,
Reinaldo
P.S. The modified macro:
// Returns an options array where the name of the option is the Name of
the polygon and the value is its perimeter
// it also returns the total perimeter of all areas found
//
Macro "GetPolygons" (sLayerName, sSetName, sNameField)
SetLayer(Favelas2010)
// *//*SetLayer(Favelas2010.dbd)
// If I add the extension then the program does not compile I also
create a selection with the whole database, but no difference*/
/*
if sNameField = null then sNameField = "ID"
rh = GetFirstRecord (sLayerName + "|" + sSetName)
arPerimeters = {}
nTotper = o
while rh <> null do
nPer = GetPerimeter(rh2id(rh))
arPerimeters.(sLayerName.(sNameField)) = nPer
nTotper = nTotper + nPer
rh = GetNextRecord (sLayerName + "|" + sSetName ,, )
end
Return( { arPerimeters, nTotper} )
endMacro
*/
------------------------------------------------------------------------
Armando Scalise wrote:
HI Reinaldo
Here is some code that might help you do that.
I have not tested it, so bear in mind it might require some slight
changes to do what you need.
Good luck
// Returns an options array where the name of the option is the Name
of the polygon and the value is its perimeter
// it also returns the total perimeter of all areas found
//
Macro "GetPolygons" ( sLayerName, sSetName, sNameField)
SetLayer(sLayerName)
if sNameField = null then sNameField = "ID"
rh = GetFirstRecord (sLayerName + "|" + sSetName)
arPerimeters = {}
nTotper = o
while rh <> null do
nPer = GetPerimeter(rh2id(rh))
arPerimeters.(sLayerName.(sNameField)) = nPer
nTotper = nTotper + nPer
rh = GetNextRecord (sLayerName + "|" + sSetName ,, )
end
Return( { arPerimeters, nTotper} )
endMacro
2011/2/4 Reinaldo Paul Pérez Machado <[email protected]
<mailto:[email protected]>>
/*Hello,
Please, I would like to know how is it possible to get the
corresponding perimeter of a bunch of polygons in a geographic files?
Thanks in advance. Any aid would be very much appreciated. Cheers,
Reinaldo*/
--
Armando Scalise