📄 test_writeshape.phtml
字号:
<?//// This example script shows how MapScript and the PHP DBase module// can be used to create new Shapefile datasets.//// The optional DBase module must be loaded for this to work:// - On Windows, use dl("php3_dbase.dll")// - On Unix, configure PHP with the --with-dbase switch and recompile it.//// Load MapScriptdl("php_mapscript.so");//----------------------------------------------------------// produce shapefile//----------------------------------------------------------function createPoint( $x, $y, $programId ){ GLOBAL $shpFile, $dbfFile; // Create shape $oShp = ms_newShapeObj(MS_SHP_POINT); $oLine = ms_newLineObj(); $oLine->addXY($x, $y); $oShp->add( $oLine ); $shpFile->addShape($oShp); // Write attribute record dbase_add_record($dbfFile, array($programId));}$shpFname = "/tmp/shptest";$shpFile = ms_newShapeFileObj( $shpFname, MS_SHP_POINT);$dbfFile = dbase_create( $shpFname.".dbf", array(array("PROG_ID", "N", 5, 0)));createPoint( 12, 34, 111);createPoint( 22, 14, 222);createPoint( 10, 20, 333);echo "Shapes Created.<BR>";//----------------------------------------------------------// done... cleanup//----------------------------------------------------------$shpFile->free();echo "Shape File ($shpFname) closed.<BR>";dbase_close($dbfFile);echo "Dbase file closed.<BR>";?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -