Great.

How would I go about getting the fix. I am using the KyngChaos framework 
distribution of gdal and your mapnik distribution. Does this
mean I have to build both of these from source? Or would you be so kind as to 
update your distribution to include the fixes?

Thanks

On 29 Apr 2011, at 19:43 , Dane Springmeyer wrote:

> Samuel,
> 
> I could replicate this crash. I can also confirm that after I rebuilt gdal 
> trunk and mapnik against that new version of gdal, the crash went away.
> 
> So, one of the recent fixes here must avoid this problem:
> 
> http://trac.osgeo.org/gdal/log/trunk/gdal/ogr/ogrsf_frmts/s57
> 
> Dane
> 
> 
> On Apr 29, 2011, at 10:01 AM, Samuel M. Smith wrote:
> 
>> I am new to Mapnik, so I am not sure if this is a bug or I am just doing 
>> something wrong.
>> I am trying to use an s57 (NOAA ENC .000) file as the datasource and extract 
>> multiple layers from the same file.
>> I am using Mapnik2 from http://dbsgeo.com/downloads/  on OS X 10.6.6 with 
>> the Kyngchaos 1.8 framework distribution.
>> 
>> 
>> I have no problem extracting one layer at a time and generating a mapnik map 
>> but if I try to use two layers then mapnik crashes with
>> a segmentation fault. Either layer works fine independently (I tried several 
>> different layers and they all work independently but any
>> time I use more than one layer I get the fault.
>> 
>> The seg fault is caused  when I call mapnik.Ogr() the second time as in:
>> 
>> seaData = mapnik.Ogr(file= srcPath, layer='SEAARE')
>> landData = mapnik.Ogr(file= srcPath, layer='LNDARE') #seg fault occurs here
>> 
>> Also the first time in the same python session in a terminal that I try to 
>> use two layers I get a cryptic warning but both layers plot. 
>> Any subsequent attempts produce the seg fault. I have to close the terminal 
>> window to "reset" something in mapnik, that then produces the warning,and 
>> then subsequent seg faults. I would guess that Mapnik is locking up a 
>> resource associated with the file that should be reentrant
>> but is not. (Or maybe its me)
>> 
>> Here is the warning. 
>> 
>> Warning 1: Illegal feature attribute id (ATTF:ATTL[0]) of 116
>> on feature FIDN=333014085, FIDS=4843.
>> Skipping attribute, no more warnings will be issued.
>> 
>> 
>> The code is below 
>> 
>> def TestENC(srcFile, dstFile):
>>    """Generates map image from NOAA ENC format source file (S57 .000)
>>       specified by srcFile. If srcFile has extension .000 then extracts base
>>       if not then uses srcFile as base
>>       so that complete path to source is given by
>>       ../data/ENC/Florida/base/base.000
>>       
>>       Saves map image as .png  in folder ../maps/ with file name dstFile
>>       
>>       Usage: mapt.TestENC('US5FL88M', 'Test188')
>>    """
>>    import mapnik2 as mapnik
>>    
>>    base, ext = os.path.splitext(srcFile)
>>    if ext not in['.000']:
>>       srcFile = '.'.join([srcFile, '000'])
>>    
>>    base, ext = os.path.splitext(srcFile)
>>    srcPath = os.path.join("../data/ENC/Florida/",base, srcFile)
>>    print "Source file = %s" % srcPath
>>    
>>    base, ext = os.path.splitext(dstFile)
>>    if ext not in ['.png']:
>>       dstFile = '.'.join([dstFile, 'png'])
>>    dstPath = os.path.join( "../maps/", dstFile)
>>    print "Destination file = %s" % dstPath
>>    
>>    MIN_LAT  = 27.475
>>    MAX_LAT  = 27.490
>>    MIN_LONG = -80.32
>>    MAX_LONG = -80.25
>>    
>>    MAP_WIDTH  = 800
>>    MAP_HEIGHT = 600
>>    
>>    print "Setting up styles"
>>    # Set up our "Sea Area" layer styles
>>    seaStyle = mapnik.Style()
>>    
>>    rule = mapnik.Rule()
>>    symbol = mapnik.PolygonSymbolizer(mapnik.Color('rgb(0%,20%,80%)'))
>>    rule.symbols.append(symbol)
>>    seaStyle.rules.append(rule)
>>    
>>    rule = mapnik.Rule()
>>    symbol = mapnik.LineSymbolizer(mapnik.Color('rgb(0%,0%,0%)'), 0.1)
>>    rule.symbols.append(symbol)
>>    seaStyle.rules.append(rule)
>>    
>>     # Set up our "Land Area" layer styles.
>>    landStyle = mapnik.Style()
>>    
>>    rule = mapnik.Rule()
>>    #rule.filter = mapnik.Filter("[NAME] = 'Angola'")
>>    symbol = mapnik.PolygonSymbolizer(mapnik.Color('rgb(15%,80%,15%)'))
>>    rule.symbols.append(symbol)
>>    landStyle.rules.append(rule)
>>    
>>    rule = mapnik.Rule()
>>    symbol = mapnik.LineSymbolizer(mapnik.Color('rgb(0%,0%,0%)'), 0.1)
>>    rule.symbols.append(symbol)
>>    landStyle.rules.append(rule)
>>    
>>    print "Setting up layers"
>>    # Set up our map layers.
>>    
>>    print "Setting up sea layer"
>>    # Sea Layer
>>    # Set up datasource for layer
>>    seaData = mapnik.Ogr(file= srcPath, layer='SEAARE')
>>    # Setup layer and attach data and styles
>>    seaLayer = mapnik.Layer("Sea")
>>    seaLayer.datasource = seaData
>>    seaLayer.styles.append("seaStyle")
>>    
>>    print "Setting up land layer"
>>    # Land Layer
>>    # Set up datasource for layer
>> #*************** Next line causes the fault  *************/
>>    landData = mapnik.Ogr(file= srcPath, layer='LNDARE')
>>    # Setup layer and attach data and styles
>>    landLayer = mapnik.Layer("Land")
>>    landLayer.datasource = landData
>>    landLayer.styles.append("landStyle")
>>   
>>    # Create our map.
>>    # +proj=longlat means use units of angular degrees
>>    map = mapnik.Map(MAP_WIDTH, MAP_HEIGHT, "+proj=longlat +datum=WGS84")
>>    
>>    map.background = mapnik.Color('rgb(80%,80%,80%)')
>>    
>>    map.append_style("landStyle", landStyle)
>>    map.append_style("seaStyle", seaStyle)
>>    
>>    map.layers.append(seaLayer)
>>    map.layers.append(landLayer)
>>    
>>    # Finally, render the map.
>>    print "Rendering Map"
>>    map.zoom_to_box(mapnik.Envelope(MIN_LONG, MIN_LAT, MAX_LONG, MAX_LAT))
>>    mapnik.render_to_file(map,dstPath, "png")
>> 
>> 
>> 
>> **********************************************************************
>> Samuel M. Smith Ph.D.
>> 242 East 600 North, Lindon Utah 84042-1662 USA
>> 
>> 801-768-2768 voice
>> 801-768-2769 fax
>> 
>> **********************************************************************
>> "The greatest source of failure and unhappiness in the world is 
>> giving up what we want most for what we want at the moment"
>> **********************************************************************
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Mapnik-users mailing list
>> [email protected]
>> https://lists.berlios.de/mailman/listinfo/mapnik-users
> 

**********************************************************************
Samuel M. Smith Ph.D.
242 East 600 North, Lindon Utah 84042-1662 USA
801-768-2768 voice
801-768-2769 fax

**********************************************************************
"The greatest source of failure and unhappiness in the world is 
giving up what we want most for what we want at the moment"
**********************************************************************






_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to