Servus there,

i have a problem with a perl script wich i know worked sooner. with the 
new set of files to load - amount doubled aprox to 3000 - the server 
somewhen just stops and gives me an out of memory bubu.

i am running on a tomcat7, machine has 4 gigs o ram, xmlfile produced by 
layerscript is about 700M.


in the script i first build up the metadata from geotiff files, then 
create xmlfile to send to rest. I tried POST and PUTS as you can see...


so is the problem the ram of that machine or is my script bugfuggd?

thanx for help
nj

<snipp>
opendir(DIR, $f_dir) or die 'dumbo boogie' . $f_dir.'>>'. $!;

while (my $file = readdir(DIR)) {


print ">o>" . $file . "\t" . $EOL;

        # Use a regular expression to ignore files beginning with a period
        next if ($file =~ m/^\./);
        
        my $f_geotiff = $file .'/'. $file. '.geotiff';

        print ">>>>" . $file . "\t" . $EOL;
        print ">>>>" . 
substr($file,8,1)."\t".substr($file,9,2)."\t".substr($file,11,1)."\t".substr($file,12,3)
 
. "\t" . $EOL;

        # need to add to layergroup
        # done in post fileitem handling
        # $geos_layers [NortOrSouth][{{:digit:}}[2]][EastOrWest][{{:digit:}}[2]]
        
$geos_layers{substr($file,8,1)}{substr($file,9,2)}{substr($file,11,1)}{substr($file,12,3)}
 = $file;
        
}

closedir(DIR);

print ">>T>>" . $f_temp . "\t" . $EOL;
# namespace fixups
#
# not needed, because workspace must be present...20121225
#
#my $crNamespacefixups = `curl -u $geos_user:$geos_passwd -v -XPUT -H 
'Content-Type: application/xml' -d 
'<namespace><prefix>$geos_workspace</prefix><uri>http://nuttijay.is-a-geek.org/$geos_workspace</uri></namespace>'
 
  http://$geos_host:$geos_port/geoserver/rest/namespaces/$geos_workspace`;      
#print '++>' . $crNamespacefixups . $EOL .'<++' .$EOL;  


my $geos_layerlistxml;
my $geos_styleslistxml;
my $geos_layergroupxml;

my $f_temp = $f_tempdir.$geos_workspace.'.xml';
# tempfilecleanup
if (-s $f_temp) {
        `rm $f_temp`
}
open (MYFILE, ">>$f_temp");

print MYFILE '<?xml version="1.0" encoding="UTF-8"?>';
print MYFILE '
<layerGroup>
   <name>' . $geos_layergroup. '</name>
   <layers>
        ';

foreach  my $l_lattype ( sort keys %geos_layers )  {
#       print "+pling+Lt+ " . $l_lattype . $EOL;
        
        foreach  my $l_latval ( reverse sort keys %{ $geos_layers{$l_lattype} } 
)  {
#               print "+pling+Lv+  " . $l_latval . $EOL;


                foreach  my $l_lontype ( sort keys %{ 
$geos_layers{$l_lattype}{$l_latval} } )  {
#                       print "+pling+LT+    " . $l_lontype . $EOL;
                        
                        foreach  my $l_lonval ( sort keys %{ 
$geos_layers{$l_lattype}{$l_latval}{$l_lontype} } )  {
#                               print "+pling+lV+     " . $l_lonval . $EOL;

#                               $geos_layerlistxml .= '<layer>' . 
$geos_layers{$l_lattype}{$l_latval}{$l_lontype}{$l_lonval} . 
'</layer>';                                     
                                $geos_layerlistxml .= '<layer>' . 
$geos_csname_prefix.$l_lattype.$l_latval.$l_lontype.$l_lonval . '</layer>';     
                                print MYFILE $geos_layerlistxml;
                                
                                $geos_styleslistxml .= '<style>demFull</style>';

                        }       
                }
                                
        }       
}

print MYFILE '</layers>
   <styles>
     ';

foreach  my $l_lattype ( sort keys %geos_layers )  {
#       print "+pling+Lt+ " . $l_lattype . $EOL;
        
        foreach  my $l_latval ( reverse sort keys %{ $geos_layers{$l_lattype} } 
)  {
#               print "+pling+Lv+  " . $l_latval . $EOL;


                foreach  my $l_lontype ( sort keys %{ 
$geos_layers{$l_lattype}{$l_latval} } )  {
#                       print "+pling+LT+    " . $l_lontype . $EOL;
                        
                        foreach  my $l_lonval ( sort keys %{ 
$geos_layers{$l_lattype}{$l_latval}{$l_lontype} } )  {
#                               print "+pling+lV+     " . $l_lonval . $EOL;

#                               $geos_layerlistxml .= '<layer>' . 
$geos_layers{$l_lattype}{$l_latval}{$l_lontype}{$l_lonval} . 
'</layer>';                                     
                                $geos_layerlistxml .= '<layer>' . 
$geos_csname_prefix.$l_lattype.$l_latval.$l_lontype.$l_lonval . '</layer>';     
                                
                                $geos_styleslistxml .= '<style>demFull</style>';
                                print MYFILE $geos_styleslistxml;

                        }       
                }
                                
        }       
}

print MYFILE '</styles>
</layerGroup>';

close (MYFILE);

#print 'http://' .$geos_host. ':' .$geos_port. 
'/geoserver/wms/reflect?layers=' . $geos_layergroup . $EOL;


#my $crLayerGadd = `curl -u $geos_user:$geos_passwd -XPUT -H 
'Content-type: application/xml' -d '$geos_layergroupxml' 
http://$geos_host:$geos_port/geoserver/rest/workspaces/$geos_workspace/layergroups.xml`;
my $crLayerGadd = `curl -vv -u $geos_user:$geos_passwd -XPOST -D 
$f_temp.txt -T $f_temp -H "Content-type:text/xml" --location 
http://$geos_host:$geos_port/geoserver/rest/layergroups`;
print "$crLayerGadd" .$EOL;
print '+=> ' .$crLayerGadd . $EOL . '<+=' . $EOL;


sub sendData() {

$geos_layergroupxml = '<layerGroup>
   <name>' . $geos_layergroup. '</name>
   <layers>
        ' .$geos_layerlistxml. '
   </layers>
   <styles>
     ' .$geos_styleslistxml. '
   </styles>
</layerGroup>';

print '+=> # # # # # # # # # # # # # <+=' . $EOL;print '+=> # # # # # # 
# # # # # # # <+=' . $EOL;
print $geos_layergroupxml . $EOL;               
print '+=> # # # # # # # # # # # # # <+=' . $EOL;               
## exec block                           
#my $crLayerGadd = `curl -u $geos_user:$geos_passwd -XPOST -H 
'Content-type: application/xml' -d '$geos_layergroupxml' 
http://$geos_host:$geos_port/geoserver/rest/workspaces/$geos_workspace/layergroups.xml`;
my $crLayerGadd = `curl -u $geos_user:$geos_passwd -XPUT -H 
'Content-type: application/xml' -d '$geos_layergroupxml' 
http://$geos_host:$geos_port/geoserver/rest/workspaces/$geos_workspace/layergroups.xml`;
print '+=> ' .$crLayerGadd . $EOL . '<+=' . $EOL;

$geos_layerlistxml = '';
$geos_styleslistxml = '';
$geos_layergroupxml = '';

}


<snapp>

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to