[mapserver-users] My experience on Python Mapscript Installation

Sung-Gheel Jang sjang3 at uiuc.edu
Wed Sep 25 11:26:03 EDT 2002


Thanks Sven,

I have finally compiled Python MapScript. As mentioned in the MapServerWiki, we
have to understand the SWIG command variables. My problem was -DSWIGPYTHON
option. For some reasons, SWIG version 1.3.15 didn't accept -DSWIGPYTHON option
in my SuSE linux box. I compiled it from the source tree. So, after deleting the
1.3.15 version of SWIG, I installed the 1.3.9 version which was included in the
SuSE's software installation module. Then, the setup.py compiled Python
MapScript successfully.

In the setup.py, I found some things to be properly described:
1) gd_dir="/usr/local/src/gd-1.8.4" (depending upon your system)
2) path.join(local_dir,'lib/gdal.a') was duplicated.
   one of them must be path.join(local_dir,'lib/libgd.a')
3) you have to check if the extra objects are in the proper location (i.e.
/usr/local/lib/) If not, you have to copy them from the source tree to there.
4) you have to understand which libraries are working on your machine (i.e.
'gd','freetype','ttf','png','proj','pq','z'). 'pq' is for PostgreSQL.

As somebody already mentioned in the previous mailing list, you can check the
Python Mapscript like this:

Python 2.2 (#1, May 14 2002, 18:23:13)
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapscript
>>> dir()
['__builtins__', '__doc__', '__name__', 'mapscript']
>>> dir(mapscript)
['DBFInfo', 'DBFInfoPtr', 'FTDouble', 'FTInteger', 'FTInvalid', 'FTString',
'GetMapserverUnitUsingProj', 'MS_AUTO', 'MS_BITMAP', 'MS_CC', 'MS_CJC_BEVEL',
'MS_CJC_BUTT', 'MS_CJC_MITER', 'MS_CJC_NONE', 'MS_CJC_ROUND', 'MS_CJC_SQUARE',
'MS_CJC_TRIANGLE', 'MS_CL', 'MS_CR', 'MS_DD', 'MS_DEFAULT', 'MS_DELETE',
'MS_DONE', 'MS_EMBED', 'MS_FAILURE', 'MS_FALSE', 'MS_FEET', 'MS_FILE_MAP',
'MS_FILE_SYMBOL', 'MS_GIANT', 'MS_GIF', 'MS_GML', 'MS_HILITE', 'MS_INCHES',
'MS_INLINE', 'MS_JPEG', 'MS_KILOMETERS', 'MS_LARGE', 'MS_LAYER_ANNOTATION',
'MS_LAYER_CIRCLE', 'MS_LAYER_LINE', 'MS_LAYER_POINT', 'MS_LAYER_POLYGON',
'MS_LAYER_QUERY', 'MS_LAYER_RASTER', 'MS_LC', 'MS_LL', 'MS_LR', 'MS_MEDIUM',
'MS_METERS', 'MS_MILES', 'MS_MULTIPLE', 'MS_NO', 'MS_NORMAL', 'MS_OFF',
'MS_OGR', 'MS_ON', 'MS_ORACLESPATIAL', 'MS_PIXELS', 'MS_PNG', 'MS_POSTGIS',
'MS_SDE', 'MS_SELECTED', 'MS_SHAPEFILE', 'MS_SHAPEFILE_ARC',
'MS_SHAPEFILE_MULTIPOINT', 'MS_SHAPEFILE_POINT', 'MS_SHAPEFILE_POLYGON',
'MS_SHAPE_LINE', 'MS_SHAPE_NULL', 'MS_SHAPE_POINT', 'MS_SHAPE_POLYGON',
'MS_SHP_ARCM', 'MS_SHP_MULTIPOINTM', 'MS_SHP_POINTM', 'MS_SHP_POLYGONM',
'MS_SINGLE', 'MS_SMALL', 'MS_SUCCESS', 'MS_TILED_SHAPEFILE', 'MS_TINY',
'MS_TRUE', 'MS_TRUETYPE', 'MS_UC', 'MS_UL', 'MS_UNUSED_1', 'MS_UR',
'MS_VERSION', 'MS_WBMP', 'MS_WMS', 'MS_XY', 'MS_YES', 'MapScript', 'MapScriptc',
'__builtins__', '__doc__', '__file__', '__name__', '__path__', 'classObj',
'classObjPtr', 'colorObj', 'colorObjPtr', 'imageObj', 'imageObjPtr', 'itemObj',
'itemObjPtr', 'labelCacheMemberObj', 'labelCacheMemberObjPtr', 'labelCacheObj',
'labelCacheObjPtr', 'labelObj', 'labelObjPtr', 'layerObj', 'layerObjPtr',
'legendObj', 'legendObjPtr', 'lineObj', 'lineObjPtr', 'mapObj', 'mapObjPtr',
'markerCacheMemberObj', 'markerCacheMemberObjPtr', 'msDBFAddField',
'msDBFClose', 'msDBFCreate', 'msDBFGetFieldCount', 'msDBFGetFieldInfo',
'msDBFGetItemIndex', 'msDBFGetItemIndexes', 'msDBFGetItems',
'msDBFGetRecordCount', 'msDBFGetValueList', 'msDBFGetValues', 'msDBFOpen',
'msDBFReadDoubleAttribute', 'msDBFReadIntegerAttribute',
'msDBFReadStringAttribute', 'msDBFWriteDoubleAttribute',
'msDBFWriteIntegerAttribute', 'msDBFWriteStringAttribute', 'msFreeImage',
'msSaveImage', 'pointObj', 'pointObjPtr', 'projectionObj', 'projectionObjPtr',
'queryMapObj', 'queryMapObjPtr', 'rectObj', 'rectObjPtr', 'referenceMapObj',
'referenceMapObjPtr', 'resultCacheMemberObj', 'resultCacheMemberObjPtr',
'resultCacheObj', 'resultCacheObjPtr', 'scalebarObj', 'scalebarObjPtr',
'shapeObj', 'shapeObjPtr', 'shapefileObj', 'shapefileObjPtr', 'styleObj',
'styleObjPtr', 'webObj', 'webObjPtr']
>>> len(dir(mapscript))
167
>>> mapscript.MS_VERSION
'3.6.1'
>>>


Now, I believe I am ready to examine those mapscript objects in the python code. 

Cheers,

Sung-Gheel

-- 
Sung-Gheel Jang
Department of Urban & Regional Planning
University of Illinois at Urbana-Champaign
111 T Buell Hall, 611 Taft Dr.
Champaign, IL 61820
Tel: (217)333-1369
E-mail: sjang3 at uiuc.edu



More information about the mapserver-users mailing list