MapServer, MapScript, WFS
Nolte, Tim
Tim.Nolte at IPCSWIRELESSINC.COM
Thu Jan 31 12:58:32 PST 2008
I've been struggling trough trying to get a WFS service setup. I have a
working MapServer. I've setup a pretty basic mapfile. Most of the
interaction works, however once I select a feature to load it just sort
of hangs and then eventually dies. My goal is to be able to serve up
points from our Oracle Spatial database to the MapInfo Professional
client. Can anyone give me any pointers. I'm using PHP MapScript to do
some wrapping.
sites.map:
MAP
NAME "iPCS Wireless MapServer"
EXTENT -104.29 29.71 -71.55 52.63
UNITS DD
FONTSET "../etc/fonts/fonts.txt"
IMAGECOLOR 255 255 255
SYMBOLSET "../etc/symbols.sym"
CONFIG PROJ_LIB "/usr/local/share/proj"
SHAPEPATH "../data"
SIZE 768 576 #1000 700 #1200 800 #600 400
STATUS ON
# ==================================================
# Web Interface Definition
# ==================================================
WEB
METADATA
"wfs_title" "iPCS Wireless MapServer - Cell Sites"
"wfs_abstract" "iPCS cell sites as currently set in EON"
"wfs_onlineresource"
"http://mapserver.ilpcs.com/cgi-bin/mapserv?map=/export/home/www/ipcs/ma
p/sites.map&SERVICE=WFS&VERSION=1.0.0"
"wfs_srs" "EPSG:4269 EPSG:42304 EPSG:42101 EPSG:4326"
"ows_schemas_location" "http://ogc.dmsolutions.ca"
END
IMAGEPATH "/export/home/www/ipcs/mapserver/.cache/ms_tmp/"
IMAGEURL "/ms_tmp/"
END
# ==================================================
# Projection Definition
# ==================================================
PROJECTION
"init=epsg:4269"
END
# ==================================================
# Layer: iPCS Cell Sites
# ==================================================
LAYER
GROUP "Cell Sites"
NAME InAcquisition
TYPE POINT
STATUS ON
CONNECTIONTYPE oraclespatial
CONNECTION "username/password at SID"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "geom FROM (SELECT st.bts_nbr, sgt.geom FROM site_tab st,
site_geom_tab sgt WHERE st.site_id = sgt.site_id AND st.site_status_id =
2) USING SRID 8307"
LABELITEM "bts_nbr"
METADATA
"wfs_title" "In Acquisition"
"wfs_featureid" "bts_nbr"
"wfs_include_items" "all"
"gml_featureid" "bts_nbr"
"gml_include_items" "all"
END
DUMP TRUE
PROJECTION
"init=epsg:42304"
END
CLASS
NAME "In Acquisition"
STYLE
SYMBOL "circle"
COLOR 0 0 0
OUTLINECOLOR 255 255 255
SIZE 12
END
LABEL
TYPE TRUETYPE
FONT "sans"
SIZE 7
POSITION CR
OFFSET 0 2
ANGLE AUTO
BUFFER 3
MINDISTANCE 30
MINFEATURESIZE 10
COLOR 0 0 0
OUTLINECOLOR 245 245 231
SHADOWSIZE 3 3
BACKGROUNDSHADOWSIZE 1 -1
END
END
END
LAYER
GROUP "Cell Sites"
NAME InConstruction
TYPE POINT
STATUS ON
CONNECTIONTYPE oraclespatial
CONNECTION "username/password at SID"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "geom FROM (SELECT st.bts_nbr, sgt.geom FROM site_tab st,
site_geom_tab sgt WHERE st.site_id = sgt.site_id AND st.site_status_id =
3) USING SRID 8307"
LABELITEM "bts_nbr"
METADATA
"wfs_title" "In Construction"
"wfs_featureid" "bts_nbr"
"wfs_include_items" "all"
"gml_featureid" "bts_nbr"
"gml_include_items" "all"
END
DUMP TRUE
PROJECTION
"init=epsg:42304"
END
CLASS
NAME "In Construction"
STYLE
SYMBOL "circle"
COLOR 30 0 255
OUTLINECOLOR 255 255 255
SIZE 12
END
LABEL
TYPE TRUETYPE
FONT "sans"
SIZE 7
POSITION CR
OFFSET 0 2
ANGLE AUTO
BUFFER 3
MINDISTANCE 30
MINFEATURESIZE 10
COLOR 0 0 0
OUTLINECOLOR 245 245 231
SHADOWSIZE 3 3
BACKGROUNDSHADOWSIZE 1 -1
END
END
END
LAYER
GROUP "Cell Sites"
NAME OnAir
TYPE POINT
STATUS ON
CONNECTIONTYPE oraclespatial
CONNECTION "username/password at SID"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "geom FROM (SELECT st.bts_nbr, sgt.geom FROM site_tab st,
site_geom_tab sgt WHERE st.site_id = sgt.site_id AND st.site_status_id
IN (4,7)) USING SRID 8307"
LABELITEM "bts_nbr"
METADATA
"wfs_title" "On-Air"
"wfs_featureid" "bts_nbr"
"wfs_include_items" "all"
"gml_featureid" "bts_nbr"
"gml_include_items" "all"
END
DUMP TRUE
PROJECTION
"init=epsg:42304"
END
CLASS
NAME "On-Air"
STYLE
SYMBOL "circle"
COLOR 22 129 17
OUTLINECOLOR 255 255 255
SIZE 12
END
LABEL
TYPE TRUETYPE
FONT "sans"
SIZE 7
POSITION CR
OFFSET 0 2
ANGLE AUTO
BUFFER 3
MINDISTANCE 30
MINFEATURESIZE 10
COLOR 0 0 0
OUTLINECOLOR 245 245 231
SHADOWSIZE 3 3
BACKGROUNDSHADOWSIZE 1 -1
END
END
END
END # Map File
wfs.php:
<?php
/*
Desc: WFS Service
Author: Timothy J Nolte - tnolte at ilpcs.com
Change Log:
*/
ini_set('display_errors','Off');
/*$request = ms_newowsrequestobj();
$request->loadparams();*/
$request = ms_newOwsRequestObj();
foreach ($_GET as $k=>$v) {
$request->setParameter($k, $v);
}
/* example on how to modify the parameters */
$request->setParameter("SERVICE","WFS");
$request->setParameter("VERSION","1.0.0");
ms_ioinstallstdouttobuffer();
$oMap = ms_newMapObj("../map/sites.map");
$oMap->owsdispatch($request);
$contenttype = ms_iostripstdoutbuffercontenttype();
$buffer = ms_iogetstdoutbufferstring();
header('Content-Type: text/xml');
echo $buffer;
ms_ioresethandlers();
?>
----
Timothy J Nolte - tnolte at ilpcs.com
Associate Network Planning Engineer
iPCS Wireless, Inc.
4717 Broadmoor Ave, Suite G
Kentwood, MI 49512
Office: 616-656-5163
PCS: 616-706-2438
Fax: 616-554-6484
Web: www.ipcswirelessinc.com
More information about the MapServer-users
mailing list