Closed tbonfort closed 12 years ago
Author: hobu Date: 2007/08/04 - 23:58 I rolled back to d7288bfd83118aa3190e750d0df90c1952235546 (r5714) and things work. The graticule data is in #2202
MAP
EXTENT -180 -90 180 90
FONTSET "/Users/hobu/svn/mapserver/tests/fonts.txt"
SYMBOLSET "symbols.sym"
IMAGECOLOR 255 255 255
IMAGETYPE png
SIZE 400 400
STATUS ON
UNITS METERS
NAME "MS"
# DEBUG 1
OUTPUTFORMAT
NAME "png"
MIMETYPE "image/png"
DRIVER "GD/PNG"
EXTENSION "png"
IMAGEMODE "PC256"
TRANSPARENT FALSE
END
# outputformat
# name "agg"
# driver "AGG/PNG"
# end
#
# SYMBOL
# NAME "circle"
# TYPE ellipse
# FILLED true
# POINTS
# 1 1
# END
# END
PROJECTION
"init=epsg:4326"
END
LAYER
# CLASSITEM "TYPE"
DATA "data/world_borders.shp"
# DEBUG 1
# LABELITEM "VALUE"
# OPACITY 40
NAME "world_borders"
PROJECTION
"init=epsg:4326"
END
STATUS DEFAULT
TYPE POLYGON
UNITS DD
CLASS
STYLE # solid fill
COLOR 0 104 104
END
STYLE # thick outline (could use a circle symbol with size too)
OUTLINECOLOR 0 0 0
WIDTH 2
ANTIALIAS TRUE
END
END
END
LAYER
CLASSITEM "TYPE"
DATA "data/graticule.shp"
# DEBUG 1
LABELITEM "VALUE"
NAME "base_layer"
PROJECTION
"init=epsg:4326"
END
STATUS DEFAULT
TYPE LINE
UNITS DD
CLASS
EXPRESSION ([TYPE] EQ 1)
LABEL
ANTIALIAS TRUE
FONT "Vera"
SIZE 6
TYPE TRUETYPE
COLOR 255 0 0
FORCE FALSE
MINDISTANCE 200
MINFEATURESIZE -1
PARTIALS TRUE
POSITION AUTO
END
STYLE
COLOR 0 0 255
# WIDTH 6
SIZE 3
SYMBOL 'circle'
END
END
END
END
import sys
sys.path.insert(0,'/Users/hobu/svn/mapserver/mapscript/python/build/lib.darwin-8.10.1-i386-2.3')
import mapscript
import cStringIO
def get_srs(url):
import urllib2
return urllib2.urlopen(url).read()
def get_extent(bounds, srs):
ll = mapscript.pointObj()
ll.x = bounds[0]
ll.y = bounds[1]
ur = mapscript.pointObj()
ur.x = bounds[2]
ur.y = bounds[3]
# project our point into the mapObj's projection
output_proj = mapscript.projectionObj(srs)
print srs
input_proj = mapscript.projectionObj("init=epsg:4326")
ll.project(input_proj, output_proj)
ur.project(input_proj, output_proj)
print 'in bounds: ', bounds
print 'out bounds: ', (ll.x, ll.y, ur.x, ur.y)
return (ll.x, ll.y, ur.x, ur.y)
def render(bounds, url):
mo = mapscript.mapObj('render.map')
srs = get_srs(url)
extent = get_extent(bounds, srs)
mo.setProjection(srs)
mo.setExtent(*extent)
im = mo.draw()
print im
print im.format
print im.width, im.height
print im.this, im.thisown
print dir(im)
im.save('foo2.png')
data = im.saveToString()
# data = im.getBytes()
output = cStringIO.StringIO(data)
return output
b = (-5.2, 42.25, 8.23, 51.1)
o = render(b, 'http://spatialreference.org/ref/epsg/27572/proj4/')
f = file('junk.png','wb')
f.write(o.read())
f.close()
# # Mollweide Projection
# mo.setSize(600, 300)
# mo.setProjection('+proj=moll +lon_0=0.0')
# mo.setExtent(-18100000, -9050000, 18100000, 9050000)
# im = mo.draw()
# im.save('graticule-moll.png')
#
# mo.setSize(400, 400)
# mo.setProjection('+proj=ortho +lon_0=0.0 +lat_0=40.0')
# mo.setExtent(-6400000,-6400000,6400000,6400000)
# im = mo.draw()
# im.save('graticule-ortho.png')
Author: hobu Date: 2007/08/05 - 00:03 Things work as expected in 9aa5f3d5c60618b005f1d6e65ea627b1103ed0cd (r6386)
Author: hobu Date: 2007/08/05 - 00:44 last comment was incorrect.
e9a7f3f1314c76b42b393cf631fe7011ff170dee (r5957) -- good fa243bb5ec26ba7cf8e979660ab6e45a81426c64 (r5960) -- bad
as soon as we link in AGG, it seems that imageObj.getBytes no longer works
Author: hobu Date: 2007/08/05 - 04:37 fixed in efee7fb5d86eb7c0bbafb0446589d033ee51f39c (r6462). Damn conditional struct members!!!! Die! Die! Die!
Author: hobu Date: 2007/08/05 - 04:38 485345e3c2d307665816be18bace688e7e84f349 (r6463) is related, and makes getBytes use msSaveImageBufferAGG for AGG-formated stuff
Author: warmerdam Date: 2007/08/06 - 04:49 d4a93a21e7b2da80daa83319a6280b8015ad8947 (r6468) makes imageextra field non condition to avoid this problem occuring in other contexts where the USE_AGG might not be properly available.
Reporter: hobu Date: 2007/08/04 - 18:27 Attempting to do imageObj.getBytes() results in a segfault. imageObj.save() works fine and as expected.
Here's some gdb output:
As you can see the img->img and img->img.gd seem to be getting zero'd out somehow. Any ideas? This worked fine in 4.10. I am using swig 1.3.31, and I tried rolling back to swig 1.3.29, but the same problem happened in the same way.