简介
欢迎使用MS4W,这是由Gateway Geomatics开发的快速简便的安装程序,用于为Windows及其附带应用程序(如Geomoose、MapBender、Openlayers等)设置MapServer。此软件包的目的是允许新手到高级MapServer用户在其Windows系统上快速安装MapServer开发环境。需要这样做的原因是多种多样的,但总的来说,这个软件包支持:想要快速进入稳定状态的开发人员,需要在多个安装中轻松安装相同配置的培训人员,以及需要帮助的新手,只需将所有需要的零碎部分集中在一起。
MS4W包被设计为完成Apache、PHP、MapServer CGI、MapScript(CSHARP、Java、PHP、Python)的完整安装,并提供方便且快速地安装附加应用程序的能力。在Windows上执行此操作的最简单方法是提供预先确定的目录结构,并强制所有内容进入该模具。
虽然目录结构本身是固定的,但它设计得有点可移植性。虽然ms4w_xxx.zip文件需要安装在硬盘驱动器的根目录下,但它不必是c:/drive。将包移动到另一个驱动器的根目录非常简单-只需复制到那里。要将其移动到子目录更困难-您需要在所有文件中搜索/ms4w并将其替换为新路径。
该设计还可以对核心软件包和应用程序进行简单升级,而不会影响本地配置或其他已安装应用程序的配置。
目录
以下包含在根包中:
Apache version 2.4.38PHP version 7.2.16Python version 3.7.0MapServer 7.4.0-dev CGI and MapScriptGDAL 2.4.0 and bindingsMapCache 1.7devmapserver utilitiesgdal/ogr utilitiesproj.4 utilitiesshp2tile utilityosm2pgsql utilityshapelib utilitiesshpdiff utilityavce00 utilitiesspatialite utilitiesunixutilsOWTChart 1.2.0H264 Streaming Module for Apache
小提示:
如果您的服务器需要支持特定版本的php、python、apache、mapserver、gdal、oracle、ecw、Microsoft SQL Server或任何MS4W的数百个库,或特定的Windows版本,或X64或32位的整个MS4W包,请与网关geomatics联系。
MapServer版本信息
MapServer version 7.4.0-dev (MS4W 4.0.0) OUTPUT=PNG OUTPUT=JPEGOUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPESUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIROSUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVERSUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENTSUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGISUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M SUPPORTS=PBFINPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
MapServer编译环境
由Gateway Geomatics编译、打包、记录和测试。请帮助支持这个伟大的产品,每个月由各种规模的组织下载超过6000次-请直接联系我们info@gatewaygeomatics.com以获取定制版本或请求。感谢您的大力支持!
用于生成此版本MapServer的库版本:
apache-ant-1.7.0apr-1.6.5apr-iconv-1.2.2apr-util-1.6.1berkeley-db-18.1.25bzip2-1.0.6cairo-1.14.12curl-7.63.0expat-2.2.6fcgi-2.4.0fits-3.450freetype-2.9.1freexl-1.0.5fribidi-0.19.1gdal-2.4.0geos-3.7.1gettext-runtime-0.17-sourcegiflib-5.1.2harfbuzz-1.9.0hdf-4.2.14hdf5-1.10.2httpd-2.4.38jbigkit-1.6libecwj2-3.3libgeotiff-1.4.3libiconv-1.15libjpeg-turbo-git-20180802libKML-git-20180824libpng-1.6.35librttopo-1.1.0-RC1libspatialite-5.0.0-beta0libspatialite-tools-4.4.0-RC0libsvg-0.5.0libsvg-cairio-0.5.0libtiff-git-20180817libxml2-2.9.8lua-5.1.5mapcache-1.7devmapserver-git-master-20190109mod_fcgid-2.3.9mod_h264_streaming-2.2.7mod_wsgi-4.6.5mrsid-9.5.4mysql-6.1.11netcdf-c-4.6.2openssl-1.0.2qoracle-12.2.0.1.0pcre-8.42pixman-0.34.0poppler-0.51.0postgresql-10.5proj-5.2.0protobuf-3.6.1protobuf-c-1.6.1Python-3.7.0readosm-1.0.0eshapelib-1.4.1spatialite-tools-4.4.0-RC0sqlite-3.24.0swig-1.3.39swigwin-3.0.12szip-2.1.1uriparser-0.7.5xerces-c-3.2.1zlib-1.2.7
支持的OGR格式:
有关完整的驱动程序说明,请参阅“OGR格式”页。
注意:
如果您需要特定的数据格式或更新的支持版本,请联系Gateway Geomatics以获取自定义编译信息。
Supported Formats: PCIDSK -raster,vector- (rw+v): PCIDSK Database File netCDF -raster,vector- (rw+s): Network Common Data Format PDF -raster,vector- (rw+vs): Geospatial PDF MBTiles -raster,vector- (rw+v): MBTiles EEDA -vector- (ro): Earth Engine Data API DB2ODBC -raster,vector- (rw+): IBM DB2 Spatial Database ESRI Shapefile -vector- (rw+v): ESRI Shapefile MapInfo File -vector- (rw+v): MapInfo File UK .NTF -vector- (rov): UK .NTF OGR_SDTS -vector- (rov): SDTS S57 -vector- (rw+v): IHO S-57 (ENC) DGN -vector- (rw+v): Microstation DGN OGR_VRT -vector- (rov): VRT - Virtual Datasource REC -vector- (ro): EPIInfo .REC Memory -vector- (rw+): Memory BNA -vector- (rw+v): Atlas BNA CSV -vector- (rw+v): Comma Separated Value (.csv) NAS -vector- (rov): NAS - ALKIS GML -vector- (rw+v): Geography Markup Language (GML) GPX -vector- (rw+v): GPX LIBKML -vector- (rw+v): Keyhole Markup Language (LIBKML) KML -vector- (rw+v): Keyhole Markup Language (KML) GeoJSON -vector- (rw+v): GeoJSON GeoJSONSeq -vector- (rw+v): GeoJSON Sequence ESRIJSON -vector- (rov): ESRIJSON TopoJSON -vector- (rov): TopoJSON OGR_GMT -vector- (rw+v): GMT ASCII Vectors (.gmt) GPKG -raster,vector- (rw+vs): GeoPackage SQLite -vector- (rw+v): SQLite / Spatialite ODBC -vector- (rw+): ODBC WAsP -vector- (rw+v): WAsP .map format PGeo -vector- (ro): ESRI Personal GeoDatabase MSSQLSpatial -vector- (rw+): Microsoft SQL Server Spatial Database PostgreSQL -vector- (rw+): PostgreSQL/PostGIS MySQL -vector- (rw+): MySQL OpenFileGDB -vector- (rov): ESRI FileGDB XPlane -vector- (rov): X-Plane/Flightgear aeronautical data DXF -vector- (rw+v): AutoCAD DXF CAD -raster,vector- (rovs): AutoCAD Driver Geoconcept -vector- (rw+v): Geoconcept GeoRSS -vector- (rw+v): GeoRSS GPSTrackMaker -vector- (rw+v): GPSTrackMaker VFK -vector- (ro): Czech Cadastral Exchange Data Format PGDUMP -vector- (w+v): PostgreSQL SQL dump OSM -vector- (rov): OpenStreetMap XML and PBF GPSBabel -vector- (rw+): GPSBabel SUA -vector- (rov): Tim Newport-Peace's Special Use Airspace Format OpenAir -vector- (rov): OpenAir OGR_PDS -vector- (rov): Planetary Data Systems TABLE WFS -vector- (rov): OGC WFS (Web Feature Service) WFS3 -vector- (ro): OGC WFS 3 client (Web Feature Service) HTF -vector- (rov): Hydrographic Transfer Vector AeronavFAA -vector- (rov): Aeronav FAA Geomedia -vector- (ro): Geomedia .mdb EDIGEO -vector- (rov): French EDIGEO exchange format GFT -vector- (rw+): Google Fusion Tables SVG -vector- (rov): Scalable Vector Graphics CouchDB -vector- (rw+): CouchDB / GeoCouch Cloudant -vector- (rw+): Cloudant / CouchDB Idrisi -vector- (rov): Idrisi Vector (.vct) ARCGEN -vector- (rov): Arc/Info Generate SEGUKOOA -vector- (rov): SEG-P1 / UKOOA P1/90 SEGY -vector- (rov): SEG-Y ODS -vector- (rw+v): Open Document/ LibreOffice / OpenOffice Spreadsheet XLSX -vector- (rw+v): MS Office Open XML spreadsheet ElasticSearch -vector- (rw+): Elastic Search Walk -vector- (ro): Walk Carto -vector- (rw+): Carto AmigoCloud -vector- (rw+): AmigoCloud SXF -vector- (rov): Storage and eXchange Format Selafin -vector- (rw+v): Selafin JML -vector- (rw+v): OpenJUMP JML PLSCENES -raster,vector- (ro): Planet Labs Scenes API CSW -vector- (ro): OGC CSW (Catalog Service for the Web) VDV -vector- (rw+v): VDV-451/VDV-452/INTREST Data Format GMLAS -vector- (rwv): Geography Markup Language (GML) driven by application schemas MVT -vector- (rw+v): Mapbox Vector Tiles TIGER -vector- (rw+v): U.S. Census TIGER/Line AVCBin -vector- (rov): Arc/Info Binary Coverage AVCE00 -vector- (rov): Arc/Info E00 (ASCII) Coverage NGW -raster,vector- (rw+s): NextGIS Web HTTP -raster,vector- (ro): HTTP Fetching Wrapper
Oracle - see the section of this document to enable
Tip
"ro" means read-only"rw" means read and one-time creation only"rw+" means read, create and update"w+" means write-only"v" means that it supports virtual files
支持的GDAL格式:
有关完整的驱动程序描述,请参阅gdal格式页。
注意:
如果您需要特定的数据格式或更新的支持版本,请联系Gateway Geomatics以获取自定义构建信息。
Supported Formats: VRT -raster- (rw+v): Virtual Raster DERIVED -raster- (ro): Derived datasets using VRT pixel functions GTiff -raster- (rw+vs): GeoTIFF NITF -raster- (rw+vs): National Imagery Transmission Format RPFTOC -raster- (rovs): Raster Product Format TOC format ECRGTOC -raster- (rovs): ECRG TOC format HFA -raster- (rw+v): Erdas Imagine Images (.img) SAR_CEOS -raster- (rov): CEOS SAR Image CEOS -raster- (rov): CEOS Image JAXAPALSAR -raster- (rov): JAXA PALSAR Product Reader (Level 1.1/1.5) GFF -raster- (rov): Ground-based SAR Applications Testbed File Format (.gff) ELAS -raster- (rw+v): ELAS AIG -raster- (rov): Arc/Info Binary Grid AAIGrid -raster- (rwv): Arc/Info ASCII Grid GRASSASCIIGrid -raster- (rov): GRASS ASCII Grid SDTS -raster- (rov): SDTS Raster DTED -raster- (rwv): DTED Elevation Raster PNG -raster- (rwv): Portable Network Graphics JPEG -raster- (rwv): JPEG JFIF MEM -raster- (rw+): In Memory Raster JDEM -raster- (rov): Japanese DEM (.mem) GIF -raster- (rwv): Graphics Interchange Format (.gif) BIGGIF -raster- (rov): Graphics Interchange Format (.gif) ESAT -raster- (rov): Envisat Image Format FITS -raster- (rw+): Flexible Image Transport System BSB -raster- (rov): Maptech BSB Nautical Charts XPM -raster- (rwv): X11 PixMap Format BMP -raster- (rw+v): MS Windows Device Independent Bitmap DIMAP -raster- (rov): SPOT DIMAP AirSAR -raster- (rov): AirSAR Polarimetric Image RS2 -raster- (rovs): RadarSat 2 XML Product SAFE -raster- (rov): Sentinel-1 SAR SAFE Product PCIDSK -raster,vector- (rw+v): PCIDSK Database File PCRaster -raster- (rw+): PCRaster Raster File ILWIS -raster- (rw+v): ILWIS Raster Map SGI -raster- (rw+v): SGI Image File Format 1.0 SRTMHGT -raster- (rwv): SRTMHGT File Format Leveller -raster- (rw+v): Leveller heightfield Terragen -raster- (rw+v): Terragen heightfield GMT -raster- (rw): GMT NetCDF Grid Format netCDF -raster,vector- (rw+s): Network Common Data Format HDF4 -raster- (ros): Hierarchical Data Format Release 4 HDF4Image -raster- (rw+): HDF4 Dataset ISIS3 -raster- (rw+v): USGS Astrogeology ISIS cube (Version 3) ISIS2 -raster- (rw+v): USGS Astrogeology ISIS cube (Version 2) PDS -raster- (rov): NASA Planetary Data System PDS4 -raster- (rw+vs): NASA Planetary Data System 4 VICAR -raster- (rov): MIPL VICAR file TIL -raster- (rov): EarthWatch .TIL ERS -raster- (rw+v): ERMapper .ers Labelled L1B -raster- (rovs): NOAA Polar Orbiter Level 1b Data Set FIT -raster- (rwv): FIT Image GRIB -raster- (rwv): GRIdded Binary (.grb, .grb2) MrSID -raster- (rov): Multi-resolution Seamless Image Database (MrSID) JP2MrSID -raster- (rov): MrSID JPEG2000 MG4Lidar -raster- (ro): MrSID Generation 4 / Lidar (.sid) RMF -raster- (rw+v): Raster Matrix Format WCS -raster- (rovs): OGC Web Coverage Service WMS -raster- (rwvs): OGC Web Map Service MSGN -raster- (rov): EUMETSAT Archive native (.nat) RST -raster- (rw+v): Idrisi Raster A.1 INGR -raster- (rw+v): Intergraph Raster GSAG -raster- (rwv): Golden Software ASCII Grid (.grd) GSBG -raster- (rw+v): Golden Software Binary Grid (.grd) GS7BG -raster- (rw+v): Golden Software 7 Binary Grid (.grd) COSAR -raster- (rov): COSAR Annotated Binary Matrix (TerraSAR-X) TSX -raster- (rov): TerraSAR-X Product COASP -raster- (ro): DRDC COASP SAR Processor Raster R -raster- (rwv): R Object Data Store MAP -raster- (rov): OziExplorer .MAP KMLSUPEROVERLAY -raster- (rwv): Kml Super Overlay PDF -raster,vector- (rw+vs): Geospatial PDF Rasterlite -raster- (rwvs): Rasterlite MBTiles -raster,vector- (rw+v): MBTiles PLMOSAIC -raster- (ro): Planet Labs Mosaics API CALS -raster- (rwv): CALS (Type 1) WMTS -raster- (rwv): OGC Web Map Tile Service SENTINEL2 -raster- (rovs): Sentinel 2 MRF -raster- (rw+v): Meta Raster Format PNM -raster- (rw+v): Portable Pixmap Format (netpbm) DOQ1 -raster- (rov): USGS DOQ (Old Style) DOQ2 -raster- (rov): USGS DOQ (New Style) PAux -raster- (rw+v): PCI .aux Labelled MFF -raster- (rw+v): Vexcel MFF Raster MFF2 -raster- (rw+): Vexcel MFF2 (HKV) Raster FujiBAS -raster- (rov): Fuji BAS Scanner Image GSC -raster- (rov): GSC Geogrid FAST -raster- (rov): EOSAT FAST Format BT -raster- (rw+v): VTP .bt (Binary Terrain) 1.3 Format LAN -raster- (rw+v): Erdas .LAN/.GIS CPG -raster- (rov): Convair PolGASP IDA -raster- (rw+v): Image Data and Analysis NDF -raster- (rov): NLAPS Data Format EIR -raster- (rov): Erdas Imagine Raw DIPEx -raster- (rov): DIPEx LCP -raster- (rwv): FARSITE v.4 Landscape File (.lcp) GTX -raster- (rw+v): NOAA Vertical Datum .GTX LOSLAS -raster- (rov): NADCON .los/.las Datum Grid Shift NTv1 -raster- (rov): NTv1 Datum Grid Shift NTv2 -raster- (rw+vs): NTv2 Datum Grid Shift CTable2 -raster- (rw+v): CTable2 Datum Grid Shift ACE2 -raster- (rov): ACE2 SNODAS -raster- (rov): Snow Data Assimilation System KRO -raster- (rw+v): KOLOR Raw ROI_PAC -raster- (rw+v): ROI_PAC raster RRASTER -raster- (rw+v): R Raster BYN -raster- (rw+v): Natural Resources Canada's Geoid ARG -raster- (rwv): Azavea Raster Grid format RIK -raster- (rov): Swedish Grid RIK (.rik) USGSDEM -raster- (rwv): USGS Optional ASCII DEM (and CDED) GXF -raster- (rov): GeoSoft Grid Exchange Format BAG -raster- (rwv): Bathymetry Attributed Grid HDF5 -raster- (rovs): Hierarchical Data Format Release 5 HDF5Image -raster- (rov): HDF5 Dataset NWT_GRD -raster- (rw+v): Northwood Numeric Grid Format .grd/.tab NWT_GRC -raster- (rov): Northwood Classified Grid Format .grc/.tab ADRG -raster- (rw+vs): ARC Digitized Raster Graphics SRP -raster- (rovs): Standard Raster Product (ASRP/USRP) BLX -raster- (rwv): Magellan topo (.blx) PostGISRaster -raster- (rws): PostGIS Raster driver SAGA -raster- (rw+v): SAGA GIS Binary Grid (.sdat, .sg-grd-z) XYZ -raster- (rwv): ASCII Gridded XYZ HF2 -raster- (rwv): HF2/HFZ heightfield raster OZI -raster- (rov): OziExplorer Image File CTG -raster- (rov): USGS LULC Composite Theme Grid E00GRID -raster- (rov): Arc/Info Export E00 GRID ZMap -raster- (rwv): ZMap Plus Grid NGSGEOID -raster- (rov): NOAA NGS Geoid Height Grids IRIS -raster- (rov): IRIS data (.PPI, .CAPPi etc) PRF -raster- (rov): Racurs PHOTOMOD PRF RDA -raster- (ro): DigitalGlobe Raster Data Access driver EEDAI -raster- (ros): Earth Engine Data API Image SIGDEM -raster- (rwv): Scaled Integer Gridded DEM .sigdem IGNFHeightASCIIGrid -raster- (rov): IGN France height correction ASCII Grid DB2ODBC -raster,vector- (rw+): IBM DB2 Spatial Database GPKG -raster,vector- (rw+vs): GeoPackage CAD -raster,vector- (rovs): AutoCAD Driver PLSCENES -raster,vector- (ro): Planet Labs Scenes API NGW -raster,vector- (rw+s): NextGIS Web GenBin -raster- (rov): Generic Binary (.hdr Labelled) ENVI -raster- (rw+v): ENVI .hdr Labelled EHdr -raster- (rw+v): ESRI .hdr Labelled ISCE -raster- (rw+v): ISCE raster HTTP -raster,vector- (ro): HTTP Fetching Wrapper
目录结构
ms4w/:主目录,默认位于C:盘下ms4w/Apache:阿帕奇安装ms4w/Apache/bin:阿帕奇的二进制安装文件ms4w/Apache/cgi-bin:mapserv.exe和它的支持库,还有php.ini和php.exe的位置,。ms4w/Apache/cgi-bin/zooplugins:ZOO-Project的文件的位置,以提供额外支持(看本文档的ZOO-Project部分)ms4w/Apache/conf:Apache配置文件。不应修改这些内容。将所有特定于应用程序和本地httpd.conf文件放在/ms4w/httpd.d中(请参阅该目录中的readme.txt)。ms4w/Apache/error:Apache使用的错误文件ms4w/Apache/htdocs:Apache Web根目录,除了测试之外,您不应该在这里安装太多。ms4w/Apache/icons:Apache使用的图标ms4w/Apache/include:包括针对Apache编译的目录ms4w/Apache/lib:Apache编译所需的lib文件ms4w/Apache/logs:Apache的日志文件存储在这里,应该经常存档或清理。ms4w/Apache/manual:Apache手册页。ms4w/Apache/modules:Apache模块(请参阅本文档的Apache Modules部分)ms4w/Apache/php:PHP安装ms4w/Apache/php/ext:phpmapscript dll的位置ms4w/apps:将所有应用程序置于该子目录中。ms4w/apps/etc:在Map Server的mapfiles中使用的示例字体和符号ms4w/gdalbindings:包含用于CSharp、Java和Python中的GDAL绑定(参见本文档的GDAL bindings部分)ms4w/gdaldata:针对gdal数据的格式支持的文件ms4w/gdalplugins:将gdal插件所需的DLL移动到此文件夹中,例如“oci-oci.dll”(请参阅本文档的gdal插件部分)ms4w/httpd.d:将所有特定于应用程序和本地的httpd.conf文件放在此处(请参阅该目录中的readme.txt)。ms4w/msplugins:MapServer插件DLL的位置(请参阅本文档的MapServer插件部分)ms4w/msplugins/mapscript:CSHARP、Java和Python的mapscript文件的位置(参见本文档的MapScript配置部分)ms4w/proj:PROJ.4的安装 使用的epsg文件是/ms4w/proj/nad/epsgms4w/Python:python的嵌入式安装 使用前必须执行setenv.batms4w/tmp:这里是临时文件。这个应该定期清洗ms4w/tmp/ms_tmp:需要Web访问的临时文件请转到此处(例如,由MapServer创建的图像文件)。这是作为/ms_tmp/通过url提供的。通常这意味着地图文件的imagepath为/ms4w/tmp/ms_tmp/,imageurl为/ms_tmp/ms4w/tools:包含有用的工具,如gdal/ogr实用程序和mapserv实用程序(请注意,在运行这些工具之前,必须在命令窗口中执行/ms4w/setenv.bat脚本)
-
如何安装MS4W
升级。略。
第一次解压MS4W:
请在开始安装前阅读如下指示:
-
要安装ms4w.zip文件,请使用压缩程序(例如7zip)提取驱动器根目录下的包,例如驱动器C/。如果成功,您应该在所选驱动器的根目录(例如c:/ms4w)上有一个名为“ms4w”的新目录。
警告:如果使用的是setup.exe安装程序:如果在包含空格的路径中安装MS4W,某些应用程序可能会出现问题。因此,建议不要在包含空格的路径中安装MS4W。最好在驱动器的根目录下安装ms4w,如c:/或d:。/ -
请务必遵循本地文件/MS4W/REQUIREMENTS.txt 中的说明,以便在继续运行之前在系统上安装C++可重新分配。
REQUIREMENTS.txt内容如下:
**注意:以下步骤仅适用于不使用安装程序“ms4w xxx setup.exe”的用户。(如果使用文件“ms4w_xxx.zip”,则需要执行以下步骤)-必须首先安装“微软Visual C++ + VisualStudio 2017可重新分发”包:-使用文件夹中的“vc redist.x86.exe”:/ms4w/tmp/-或从https://support.microsoft.com/en-ca/help/2977003/the-latest-supported-visual-c-downloads下载-使用x86安装程序(“vc redist.x86.exe”)
3. 通过运行/ms4w/apache-install.bat来启动ms4w apache Web服务器(打开命令提示符窗口并在命令行执行-不建议只双击该文件)。此文件将Apache安装为Windows服务(称为“ApacheWeb服务器”),以便在计算机重新启动时启动它。执行时,应在命令窗口中显示以下消息:
Installing the Apache MS4W Web Server serviceThe Apache MS4W Web Server service is successfully installed.Testing httpd.conf....Errors reported here must be corrected before the servicecan be started.The Apache MS4W Web Server service is starting.The Apache MS4W Web Server service was started successfully.
这意味着Apache,作为一个服务正在运行并且安装成功了。
Windows 10、8、7和Vista用户注意:
要运行apache-install.bat文件,必须执行以下操作:
1. 在Windows资源管理器中,转到cmd.exe文件的位置(c:/windows/system32) 2. 右键单击cmd.exe可执行文件并选择以管理员身份运行 3. 在命令提示窗口中导航到ms4w文件夹并运行apache-install.bat4. 要测试Apache是否正常运行,请打开Web浏览器并通过输入以下URL之一查找本地主机Web服务::
http://localhost/orhttp://127.0.0.1/
现在,您应该可以在Web浏览器中看到主MS4W页面。这将为您提供有关安装的一般信息以及配置信息。如果这是您第一次使用MS4W,请务必查看MS4W中安装的列出的“Features功能”,并通过选择此页上的每个链接来测试它们。.
5. 技术上讲,到这里,MS4W已经安装好了。但是,正如你可能从MS4W主页.html上看到的一样,还没有运行程序。这意味着还没有Web应用程序,如GeoMoose或OpenLayers在MS4W的Web目录/ms4w/apps/上发现。基于MS4W配置的Web应用可以在发现。
6. 要将这些Web应用程序安装到/ms4w/apps/all中,需要将Web应用程序压缩文件解压缩到与ms4w相同的根目录(例如c/)。
解压缩此文件时应该发生两件事。首先,web应用程序目录应该出现在/ms4w/apps/中。第二,新的httpd_*.conf文件应该添加到/ms4w/httpd.d/httpd_*.conf中。(/httpd.d/目录包含Apache配置文件,这些文件定义了计算机/服务器上哪些文件可以通过Web访问)。对于安装的每个Web应用程序,都将找到一个新的配置文件。)
7. The definitions of these Web-accessible directories are called Web Aliases. In order to activate a Web Alias you must restart Apache. To test your latest installed application, go to the MS4W main index.html page (i.e., ). In the applications section you should now find a link to the application you just installed. Select the link to the recently installed application to see if it is configured correctly. Another option is to find the Web Alias for your application and call it from your Web browser directly. For example, if you have installed the latest MS4W version of GeoMoose, the Web Alias is "geomoose2". To go to the GeoMoose index page, simply enter .
Note: Applications with configuration files (e.g., GeoMoose and OpenLayers) generally do not require any editing of their files in order to work. Just unzip to the appropriate driver root and restart Apache.
WARNING: It is very possible that you may wish (but not encouraged!) to run multiple versions of the same product. For example, GeoMoose 2.8.0 vs. GeoMoose 2.8.1. When installing these ms4w GeoMoose application packages, you will notice when unzipping GeoMoose that the httpd_geomoose2_ms4w.conf file found under ./ms4w/httpd.d/ will be overwritten by the GeoMoose you are currently installing. The reason for this is that the GeoMoose Alias stays the same from version to new version of GeoMoose. So, if you overwrite the httpd_geomoose2_ms4w.conf when unzipping and then restart Apache, you will get the latest version of GeoMoose that you just installed. To run both GeoMoose versions simply follow the instructions in Step 7.
8. You also can create new Web Alias(es). To configure your own personal Web Alias(es), follow the instructions in /ms4w/httpd.d/README_HTTPD.txt
Steps to Enable Oracle 10g or 11g or 12c Support in MS4W
Oracle Spatial support in MapServer is handled by two methods: 1) natively in MapServer, or 2) through the GDAL library.
-
Make sure you have Oracle 10g or 11g or 12c client software installed on your machine (the same machine that you are running MS4W on).
Warning
Since the default MS4W package is 32-bit, you must install the Oracle 32-bit client, in order to allow MapServer and its tools to communicate with Oracle (even if the Oracle server is x64). If you need a full x64 custom MS4W build please contact .
-
For direct access to Oracle Spatial, replace the existing libmap.dll in /ms4w/Apache/cgi-bin/ with the one in the /ms4w/msplugins/oracle/ folder.
If this is successful, executing the following at the commandline (after setting /ms4w/setenv.bat) "mapserv -v" should return a string that contains "INPUT=ORACLESPATIAL".
Note
It is possible that MapServer/Apache may have trouble locating your Oracle client dll (oci.dll). If you are having trouble connecting, try copying your oci.dll (possibly from a path such as /oracle/product/12.1.0/client/BIN) into the cgi-bin directory (/ms4w/Apache/cgi-bin/)
Tip
Setting the Windows environment variables and will help MapServer/GDAL connect to your Oracle instance.
-
For access to Oracle Spatial through the GDAL library, move the ogr_OCI.dll plugin file up from /ms4w/gdalplugins/ignored/oracle12/ into /ms4w/gdalplugins/
If this is successful, executing the following at the commandline (after setting /ms4w/setenv.bat) "ogrinfo --formats" should list the OCI driver.
-
Restart Apache to be safe.
-
For mapfile configuration see (note that the LAYER syntax differs depending if you use native access or through GDAL). Here are some examples:
## Connect through OGR
LAYER NAME "park-ogr" TYPE POLYGON STATUS ON CONNECTION "OCI:user/pass@SID" CONNECTIONTYPE OGR DATA "PARK" CLASS NAME "Parks" STYLE COLOR 255 0 0 OUTLINECOLOR 120 120 120 END ENDEND # Layer
Tip
In the CONNECTION parameter you can specify a different HOST or PORT with the syntax: "OCI:username/password@host:port/SID"
## Connect through MapServer's OracleSpatial type
LAYER NAME "park-native" TYPE POLYGON STATUS ON CONNECTIONTYPE oraclespatial CONNECTION "user/pass@SID" DATA "ORA_GEOMETRY FROM (SELECT ORA_GEOMETRY FROM PARK)" CLASS NAME "Parks" STYLE COLOR 255 255 0 OUTLINECOLOR 120 120 120 END ENDEND # Layer
A read-only, native MapServer driver that connects to Microsoft SQL Server 2008's spatial capabilities is available in MS4W as of version 2.3.0.
Steps to Enable SQL Server 2008 Support in MS4W's MapServer
-
The plugin exists in /ms4w/msplugins/mssql/msplugin_mssql2008.dll
-
Modify your SQL Server 2008 layer in your mapfile to use the CONNECTIONTYPE PLUGIN parameter and point to the appropriate plugin using the PLUGIN parameter. Use the CONNECTION parameter to specify the required connection parameters to access SQL Server, and use the DATA parameter to specify the table that holds the spatial information:
LAYER ... CONNECTIONTYPE PLUGIN PLUGIN "C:/ms4w/msplugins/mssql/msplugin_mssql2008.dll" CONNECTION "server=mysqlserver2008.com;uid=dbusername; pwd=dbpassword;database=Roads Database; Integrated Security=false" DATA "the_geom from roads" TYPE LINE STATUS ON CLASS ... ENDEND
-
Test your layer, possibly by using the shp2img commandline utility with the '-all_debug 5' switch
The associated RFC document with the original notes on this support is
MS4W >= 1.5.0 includes pre-built support files for CSharp, Java, PHP, and Python mapscript. In order to make use of these, however, they must be installed and configured in the appropriate locations on your system.
- Files are located in /ms4w/msplugins/mapscript/csharp
- See for installation notes.
- Learn about the SWIG MapScript API at
- Files are located in /ms4w/msplugins/mapscript/java
- Learn about the SWIG MapScript API at
Warning
As of the MS4W 4.0.0 release, PHPMapScript uses the .
- PHPMapScript dll is located in /ms4w/Apache/php/ext
- PHP's configuration file "php.ini" is located in /ms4w/Apache/cgi-bin
- PHPMapScript is loaded by default
- As of the MS4W 4.0.0 release, the PHPMapScript extension uses the SWIG MapScript API (see SWIG MapScript API docs at )
- All of your PHP scripts must now always first include the mapscript.php file containing MapServer constants:
// required SWIG include (contains MapServer constants for PHP7)include("C:/ms4w/apps/phpmapscriptng-swig/include/mapscript.php");
- Test this syntax with the provided quickmap.php file at /ms4w/Apache/htdocs/quickmap.php (see usage instructions in the top of that file)
Using the packaged Python Installation
As of MS4W 4.0, is distributed as part of the base MS4W install. To call Python, open a Command Prompt window and cd to /ms4w/ and then execute setenv.bat. You should see a message displayed such as:
GDAL, mapserv, Python, PHP, and commandline MS4W tools path set
Next, in the same window, execute python --version. You should see a response such as:
Python 3.7.0
Tip
As of MS4W 4.0, Python MapScript is already installed for you, (you can see the mapscript files inside /ms4w/Python/Lib/site-packages). You can jump to the "Testing the Configuration" steps below.
Installing the Python Mapscript Support Files
Warning
The Python mapscript support files included in this distribution are built for Python 3.7.x; they will not work with 2.7 Python versions. It is strongly recommended that you use the Python instance that is distributed inside MS4W (at /ms4w/Python/).
Quick and dirty (for use with ms4w only)
- Unpack /ms4w/msplugins/mapscript/python/mapscript*win32.zip in a safe location
- In the directory structure that results from the above step, navigate to /Python-3.7.0/Lib/site-packages
-
- You should find 3 files there:
-
- _mapscript.cp37-win32.pyd
- mapscript.py
- mapscript-<version>-py3.7.egg-info
-
- Copy the 3 files into the /ms4w/Apache/cgi-bin directory.
- Place any python cgi scripts that you want to run under ms4w in the /ms4w/Apache/cgi-bin directory, and add a "shebang" line at the top of each script. See the section on below for shebang-line details.
More robust (for system-wide access)
- Unpack /ms4w/msplugins/mapscript/python/mapscript*win32.zip in a safe location
- In the directory structure that results from the above step, navigate to /Python-3.7.0/Lib/site-packages
-
- You should find three files there:
-
- _mapscript.cp37-win32.pyd
- mapscript.py
- mapscript-<version>-py3.7.egg-info
-
- Copy the three files into the site-packages directory of your Python 3.7.x installation (eg., C:/ms4w/Python/Lib/site-packages)
- Add <drive_letter>:/ms4w/Apache/cgi-bin to your system's PYTHONPATH environment variable.
Configuring Apache to Run Python Scripts
Tip
As of MS4W 4.0, is installed for you. (you can see the mod_wsgi files inside /ms4w/Python/Lib/site-packages). For configuring the module, edit /ms4w/Apache/conf/httpd.conf and look for the section "mod_wsgi settings" around line# 617
You have a couple of additional options here:
via shebang lines
This may be the preferred approach if you have multiple Python installations on your machine.
Add a "shebang line" to the top of each python cgi script in /ms4w/apache/cgi-bin. This line must be the first line in the script, and it must begin with #! followed by the path to your systems python executable. For example:
#!C:\ms4w\Python\python.exe -u
The -u option shown above causes the script to use unbuffered output, which is generally what you need in web-serving contexts.
via Apache directives
This approach obviates the need to edit every python script in your cgi-bin directory; however, it may be problematic if you have multiple Python installations.
Add the following line to the end of ms4w/Apache/conf/httpd.conf:
ScriptInterpreterSource Registry
You may also want to add these:
SetEnv PYTHONUNBUFFERED 1PassEnv PYTHONPATH
The first of the above lines causes your python scripts to use unbuffered output (which you probably want), while the second passes the value of your system's PYTHONPATH environment variable through to Apache's environment (if set).
Testing the Configuration
Follow these steps to test your Python MapScript installation:
-
Move the file /ms4w/msplugins/mapscript/python/test-cgi-mapscript.py into the /ms4w/Apache/cgi-bin/ folder.
-
Open the file in a text editor.
-
Edit the first line of that script to point to your proper Python path.
-
In your web browser goto
-
The script tests that the Python CGI is working, and that the mapscript module can be successfully imported.
If successful you will see an HTML page listing several environment settings on your machine, as well a list of the Python MapScript module attributes at the bottom of the page.
Python Troubleshooting:
- If you get an Internal Server Error check the Apache logs for info.
- Make sure your script points to a valid Python installation path.
- Make sure you are using a recent Python version (containing the cgitb module).
Python MapScript Documentation
Python MapScript is handled through the SWIG API for MapServer:
See the previous section to configure GDAL for Oracle connections:
As of MS4W 3.2.0, an old ECW version 3.3 SDK is used to read and display ECW files in MS4W. If you require more recent functionality from the newer v5+ SDK, please contact for a custom build quote.
Steps to Enable ECW Support in MS4W
-
For access to ECW files through the GDAL library, move the gdal_ECW_JP2ECW.dll plugin file up from /ms4w/gdalplugins/ecw/ into /ms4w/gdalplugins/
If this is successful, executing the following at the commandline (after setting /ms4w/setenv.bat) "gdalinfo --formats" should list the "ECW" and "JP2ECW" drivers.
ECW -raster- (rw): ERDAS Compressed Wavelets (SDK 3.x)JP2ECW -raster,vector- (rw+v): ERDAS JPEG2000 (SDK 3.x)
-
For display in MapServer, after moving the plugin, follow the regular document. Here is an example mapfile configuration:
LAYER NAME "ecw" TYPE RASTER STATUS ON DATA "00203065F09.ecw" CLASS NAME "ECW test" ENDEND
MS4W contains GDAL bindings for CSharp, Java, and Python, and are located at /ms4w/gdalbindings
Note
Since the MS4W 4.0 release, Python is included in the base MS4W (after you run setenv.bat you can call Python). If you have your own Python instance instead: Python 3.7 is required for the Python GDAL module in MS4W, and you must have C:/python-3.7.x in your PATH to use the utilities.
The Python GDAL module and its utilities are installed in /ms4w/gdalbindings/python/gdal/. To run the utilities:
- Open a Command Prompt window
- cd ms4w
- setenv.bat
- cd gdalbindings/python/gdal
- excute the python utility, such as:
python gdal_merge.py
gdal_merge.py notes:
- -n (nodata_value) switch requires the (the embedded Python instance in MS4W already includes NumPy)
- raster_copy_with_nodata() also requires the NumPy module (the embedded Python instance in MS4W already includes NumPy)
In order to use FastCGI you must do the following:
-
Open /ms4w/Apache/conf/httpd.conf in a text editor
-
Uncomment line#178, such as:
LoadModule fcgid_module modules/mod_fcgid.so
-
At the bottom of the file you will see a commented "<IfModule fcgid_module>" section. If you want to use FastCGI directives (listed on the page) you can uncomment the section and add your directives, such as:
FcgidMinProcessesPerClass 0 FcgidIdleScanInterval 1 FcgidProcessLifeTime 10
-
If you are connecting to an Oracle database using FastCGI, you must also add your Oracle Bin directory (where the 'oci.dll' file exists) to the PATH variable above, such as:
... FcgidInitialEnv PATH "c:/oracle/product/10.2.0/client/BIN" ... -
Save the file and restart apache (execute /ms4w/apache-restart.bat)
-
Change your CGI application to point to "/fcgi-bin/mapserv.exe" instead of the usual "/cgi-bin/mapserv.exe"
-
Add the following parameter to your layer for which you want this FastCGI connection:
PROCESSING "CLOSE_CONNECTION=DEFER"
-
Try the application. If successful you should see the "mapserv.exe" process in the Windows Task Manager remain open while the user interacts with your application.
Notes:
- in testing this was successful with PostgreSQL 9.0.4 / PostGIS 1.5.2, and with Oracle 10.2.0.1.0.
- general MapServer and FastCGI notes can be found in the .
The MapCache Apache module and the mapcache_seed.exe utility (as of MS4W 3.1.0) are included. In order to use the MapCache Apache module you must do the following:
Note
For information about MS4W's included HTTPS certificate bundle, and specific tips for MapCache, see the later section of this document.
-
Open /ms4w/Apache/conf/httpd.conf in a text editor
-
Uncomment line#184, and change to your correct path, such as:
LoadModule mapcache_module "C:/ms4w/Apache/cgi-bin/mod_mapcache.dll"
-
Around line#412 of your httpd.conf file you will see a "<IfModule mapcache_module>" section. Modify the path to the included MapCache configuration (XML) file, such as:
AllowOverride None Options None Require all granted MapCacheAlias /mapcache "C:/ms4w/apps/mapcache/mapcache.xml" -
Modify the mapcache.xml file. Please see the associated for assistance.
-
Save your httpd.conf file and restart apache (execute /ms4w/apache-restart.bat)
-
If the module was successfully loaded your /ms4w/Apache/logs/error_log.txt file should contain a message similar to:
[notice] Apache/2.4.38 (Win32) mod-mapcache/1.6.1 configured-- resuming normal operations
-
Test your MapCache configuration by following steps in the associated
-
The is also included. To run the mapcache_seed.exe file be sure to first execute the /ms4w/setenv.bat file in your command window.
Notes:
-
this module was tested with the cache types: disk, sqlite, tiff, and berkeleyDB. You should follow the for assistance, or contact for assistance/custom builds/configurations.
-
the module was tested on Windows 10; if you are using an older version of Windows and require this module you should consider upgrading, or contact for assistance/custom builds/configurations. .
-
as this module is still in development, feedback is more than encouraged, it is required. Please send your MapCache questions to the . You are also encouraged to contact Gateway Geomatics for custom builds and to help fund the development and maintenance of MS4W.
The Apache module is included, as of the MS4W 4.0.0 release. In order to use the mod_wsgi Apache module you must do the following:
-
Open /ms4w/Apache/conf/httpd.conf in a text editor
-
Around line#617, make sure the paths are correct, such as:
# mod_wsgi settingsLoadFile "c:/ms4w/python/python37.dll"LoadModule wsgi_module "c:/ms4w/python/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd"WSGIPythonHome "c:/ms4w/python"
-
Save your httpd.conf file and restart apache (execute /ms4w/apache-restart.bat)
-
If the module was successfully loaded your /ms4w/Apache/logs/error_log.txt file should contain a message similar to:
[notice] Apache/2.4.38 (Win32) mod_wsgi/4.6.5 Python/3.7 configured-- resuming normal operations
-
To test that Apache has loaded the module, at your Command prompt, cd into the /ms4w/Apache/bin/ directory. Then execute the following:
httpd -t -D DUMP_MODULES
You should see a list of loaded modules, and mod_wsgi should be listed near the end, such as:
setenvif_module (shared)version_module (shared)fcgid_module (shared)mapcache_module (shared)wsgi_module (shared)
-
You can use your file explorer and see the mod_wsgi files inside the folder: /ms4w/Python/Lib/site-packages
The is included for Apache (as of MS4W 3.1.0). One of the features of this module is enabling your viewers to immediately jump to any part of the video regardless of the length of the video or whether it has all been downloaded yet. In order to use the H264 Streaming Module you must do the following:
-
Open /ms4w/Apache/conf/httpd.conf in a text editor
-
Uncomment line#183, such as:
LoadModule h264_streaming_module modules/mod_h264_streaming.so
-
Around line#608 of your httpd.conf file you will see a "<IfModule h264_streaming_module>" section. You can leave this section as-is (no changes are needed):
AddHandler h264-streaming.extensions .mp4 -
Save your httpd.conf file and restart Apache (execute /ms4w/apache-restart.bat)
-
To test that Apache has loaded the module, at your Command prompt, cd into the /ms4w/Apache/bin/ directory. Then execute the following:
httpd -t -D DUMP_MODULES
You should see a list of loaded modules, and the H264 Streaming Module should be listed near the end, such as:
log_config_module (shared)mime_module (shared)negotiation_module (shared)setenvif_module (shared)h264_streaming_module (shared)
-
To test the module on an actual video file:
-
Download this mp4 file locally (right-click and Save Link As):
-
Copy the file into the folder /ms4w/Apache/htdocs/
-
Open a Command prompt window, and cd into /ms4w/ and execute setenv.bat
-
Execute the following command in that same window:
wget -S -O mapserver-6-0-visualization.mp4 "http://127.0.0.1/mapserver-6-0-visualization.mp4?start=0&end=5"
You should see a response as follows (notice the mention of the "X-Mod-H264-Streaming" and also that the size of the video is very small (click on the saved file now in /ms4w/mapserver-6-0-visualization.mp4 and view it, only the first 5 seconds of the video should be loaded):
1 HTTP/1.1 200 OK 2 Date: Mon, 10 Jul 2017 15:10:31 GMT 3 Server: Apache/2.4.27 (Win32) mod_fcgid/2.3.9 4 X-Mod-H264-Streaming: version=2.2.7 5 Content-Length: 574375 6 Last-Modified: Thu, 03 Dec 2015 02:15:30 GMT 7 ETag: "451ed18-525f4f7037480;574375" 8 Accept-Ranges: bytes 9 Keep-Alive: timeout=5, max=10010 Connection: Keep-Alive11 Content-Type: video/mp4100%[====================================>] 574,375 547.77M/s ETA 00:00
-
Now test the module in your Web browser, by going to:
- the streamed video should be only 5 seconds long (if the whole video is shown, then there is a problem with the configuration of the module)
- experiment with the "start" and "end" parameters of the URL
-
-
Read more about the module's parameters:
As described earlier, MS4W is designed so you can easily include your application's Apache settings in the /ms4w/httpd.d/ folder (see the README_HTTPD.txt inside that folder for more information). The following examples will use the existing MS4W "MapServer CGI Viewer" application; the CGI viewer's Apache settings are stored in the file "httpd_cgi_viewer.conf" inside the /ms4w/httpd.d/ folder. The contents of the file is:
Alias /cgi/ "/ms4w/apps/cgi-viewer/htdocs/"
AllowOverride None Options Indexes FollowSymLinks Multiviews Order allow,deny Allow from all Note
If you would prefer to make your application changes directly in the /ms4w/Apache/conf/httpd.conf file you can, or also include them in an .htaccess file inside your application's folder.
Let's say one of the filenames has changed (from "viewer-index.html" to "ttt.html"), but we want to make sure the old url works. MS4W loads the mod_rewrite module by default (more about mod_rewrite: ), so we can add a few lines into our "httpd_cgi_viewer.conf" to call this rewrite, such as:
Alias /cgi/ "/ms4w/apps/cgi-viewer/htdocs/"
AllowOverride None Options Indexes FollowSymLinks Multiviews Order allow,deny Allow from all RewriteEngine On RewriteBase "/cgi/" RewriteRule "^viewer-index.html$" "ttt.html" We can alternatively use the Redirect directive through the mod_alias module, which is loaded by MS4W by default (read more about mod_alias at ) such as:
Alias /cgi/ "/ms4w/apps/cgi-viewer/htdocs/"
AllowOverride None Options Indexes FollowSymLinks Multiviews Order allow,deny Allow from all Redirect 301 "/cgi/viewer-index.html" "/cgi/ttt.html"Tip
Be sure to always restart the Apache service after any changes made to conf files (execute apache-restart.bat at the commandline, after executing setenv.bat in the same window)
and demo data are included (as of MS4W 3.1.0), giving you full WFS-Transaction support (making data changes in an MS4W map that is then saved to the underlying database). In order to use TinyOWS you must do the following:
-
Make sure that you have and installed locally, or have connection details for accessing it remotely. This has been tested with PostgreSQL 10.5 and PostGIS 2.4.4
-
First we must create a database and load some sample data:
-
Open /ms4w/apps/tinyows/demo/install-demo-data.bat in a text editor
-
If necessary, modify the PG-PORT, PG-SUPERUSER-NAME, and PG-SUPERUSER-PASSWORD for your installation (lines ~17-19). Save your changes.
-
Open a Command prompt window, and cd into /ms4w/ and execute setenv.bat
-
cd into /ms4w/apps/tinyows/demo/ and execute the following in that same window:
install-demo-data.bat
-
Verify that a new database was created ("tinyows"), and that there is a spatial table ("frida").
-
Tip
You can use to view your new "frida" PostGIS layer (through Layer/Add Layer /Add PostGIS Layers)
-
Next we must configure TinyOWS:
-
Open /ms4w/apps/tinyows/config.xml in a text editor
-
If necessary, modify the online_resource and pg connection parameters, for your installation. Refer to the TinyOWS for parameter descriptions. Save your changes.
-
to test this configuration, in the same Command prompt window, execute the following (change the drive path if necessary):
set TINYOWS_CONFIG_FILE=C:/ms4w/apps/tinyows/config.xml
-
once that is set, execute the following in the same Command prompt window to see details about your TinyOWS configuration:
tinyows.exe --check
the response should be something like:
TinyOWS version: 1.1.0FCGI support: YesConfig File Path: C:/ms4w/apps/tinyows/config.xml (TinyOWS XML)PostGIS Version: 2.4.4PostGIS dsn: host=localhost user=postgres password=postgres dbname=tinyows port=5432Output Encoding: UTF-8Database Encoding: UTF8Schema dir: /ms4w/apps/tinyows/schema/Display bbox: YesEstimated extent: NoCheck schema: YesCheck valid geoms: YesAvailable layers: public.frida (31467) -> tows:frida [RW]
-
Note that Apache sets this same environment variable TINYOWS_CONFIG_FILE in the file /ms4w/httpd.d/httpd_tinyows.conf
-
-
Next we should configure the demo HTML application:
- Open /ms4w/apps/tinyows/demo/tinyows.js in a text editor
- Verify that urls (such as ) used there are correct: see lines 65 & 69
-
Finally we are ready to test a WFS-T transaction to your database:
-
in a Web browser, goto (or modify that address if need be)
-
click on the "Draw Feature" icon on the top-right of the map, and click anywhere on the map to generate a polygon (to close the polygon double-click).
-
now click on the "Save Changes" icon, you should see a message in the right panel of that page as:
Transaction successfully completed
-
Changes to the "frida" layer should be saved to the database.
-
-