[Mapserver-users] mapObj clone() method problem

Alexandros Chimarios alhim at intracom.gr
Fri Apr 23 08:25:31 EDT 2004


Dear Frank, 

I have upgraded to Mapserver 4.2beta version and the clone method suceeded ... 
but only for the first time. When I try to clone a mapObj for second time I 
get a segmentation fault error.

Initially I thought that it might be a memory problem but then I succesfully 
tried the following code :

// FWG_Map inherits from mapObj.
mo = FWG_Map('/usr/local/apache2/cgi-bin/geodata/world.map')
mo1 = FWG_Map('/usr/local/apache2/cgi-bin/geodata/world.map')
mo2 = FWG_Map('/usr/local/apache2/cgi-bin/geodata/world.map')
mo3 = FWG_Map('/usr/local/apache2/cgi-bin/geodata/world.map')
mo4 = FWG_Map('/usr/local/apache2/cgi-bin/geodata/world.map')

This is my .map file :

SYMBOL
        NAME "star"
	TYPE TRUETYPE
        FONT arial
        CHARACTER "r"
END


# Start of map file
#
MAP
	NAME Mediteranean
	STATUS ON
	SIZE 600 600
	EXTENT 2.5256 21.5595 34.1734 53.2078
#	EXTENT -180 -90 180 90 
	
	SHAPEPATH 
"/root/downloads/Arc/Linux/ArcExplorerJava4.0.1/aej40exe/data/World"
	IMAGECOLOR 60 175 220
	IMAGETYPE JPEG
	#SYMBOLSET '/root/projects/python/symbols.ini'
	#TEMPLATE /usr/local/apache2/cgi-bin/index.html


	#  PROJECTION
 	 # 	"init=epsg:2163"
 	  #END
  
SCALEBAR
    IMAGECOLOR 255 255 255
    LABEL
      COLOR 0 0 0
      SIZE TINY
    END
    STYLE 1
    SIZE 100 2
    COLOR 0 0 0
    UNITS KILOMETERS
    INTERVALS 2
    TRANSPARENT FALSE
    STATUS ON
  END


#start of symbol definitions (we're only using a few)
  
  	SYMBOL
    		NAME 'circle'
    		TYPE ELLIPSE
    		POINTS 4 4 END
    		FILLED TRUE
  	END

  	SYMBOL
    		NAME 'star'
    		TYPE VECTOR
    		FILLED TRUE
    		POINTS
      			0 .375
      			.35 .375
      			.5 0
      			.65 .375
      			1 .375
      			.75 .625
      			.875 1
      			.5 .75
      			.125 1
      			.25 .625
    		END
  	END

	SYMBOL
		NAME 'starc'
		TYPE TRUETYPE
		FILLED TRUE
		FONT rwg
		ANTIALIAS true
		CHARACTER "*"
	END
	
	
				

   
	LAYER
    		NAME country
       
    		STATUS ON
    		DATA country
    		TYPE POLYGON
	 		 		   
    		CLASS
      			STYLE
        			COLOR 150 120 80
				OUTLINECOLOR 25 25 25
      			END
   		END
	        
    

    
	END

	LAYER

    		NAME cities

    		STATUS ON
    		DATA cities
    		TYPE POINT
			
    		LABELITEM "NAME"
		CLASS
		
	
      			STYLE
        			COLOR 255 255 0
				#SYMBOL 'starc'	
      				SYMBOL '/usr/local/apache2/cgi-bin/geodata/symbols/ctyhwy.png'
			END
			
			LABEL
				COLOR 255 255 0
				SIZE tiny
				FONT  arial
				POSITION CL
				PARTIALS TRUE
				ANTIALIAS TRUE
				MINDISTANCE 30
				BUFFER 1
			END
    		END
	END

	LAYER
        	CONNECTIONTYPE postgis
        	CONNECTION "user=alhim  dbname=fremis_geo_db  host=127.0.0.1"
        	DATA " geolocation from  unit_tracks USING UNIQUE oid   USING SRID = 
-1  "
            
        	NAME "ships"
        	STATUS OFF
		
        	TYPE POINT
            LABELITEM "unit_id"
		
        
            
            CLASS
		
	
      			STYLE
        			COLOR 255 255 0
				#SYMBOL 'starc'	
      				SYMBOL '/usr/local/apache2/cgi-bin/geodata/symbols/ctyhwy.png'
                END
                LABEL
				COLOR 255 255 0
				SIZE tiny
				FONT  arial
				POSITION CL
				PARTIALS TRUE
				ANTIALIAS TRUE
				MINDISTANCE 30
				BUFFER 1
			END
			
                
    		END


                

		
	END


END # end of map file definition








On Tuesday 20 April 2004 17:01, you wrote:
> Alexandros Chimarios wrote:
> > Hi all,
> >
> > I have a problem using Python Mapscript. In particular when i invoke
> > mapObj.clone() method i got a segmentation fault. This is my source code
> > :
> >
> > mo = mapObj('/usr/local/apache2/cgi-bin/geodata/world.map')
> > mo_clone = mo.clone()
> >
> > However, when I created a subclass of mapObj, then the clone method run
> > normally. But i have noticed that the clone method runs ok for 2 times.
> > if I try to invoke it the 3rd time i get an segmenation fault again. For
> > example :
>
> Alexandros,
>
> I don't think you mentioned which version of MapServer/MapScript you were
> using. A bunch of fixes where implemented in the map cloning capability
> about six weeks ago by Sean and I.  The 4.2 release should be in
> substantially better shape than older versions.  If you still get the
> problem with 4.2 then please submit a bug report including your mapscript
> fragment, and the .map file you are working with.   Generally it is easy to
> track down the problems given that and valgrind.
>
> Best regards,




More information about the mapserver-users mailing list