[mapserver-users] WFS-Mapscript

Kralidis,Tom [Burlington] Tom.Kralidis at ec.gc.ca
Wed Jul 9 21:10:47 EDT 2008


This works on layers of CONNECTIONTYPE WFS (i.e. MapServer fetches from the remote WFS).

When I try your PHP code against the following layer def:

 LAYER
  NAME envirodat
  GROUP "VECTOR"
  TYPE POINT
  STATUS ON
  CONNECTIONTYPE WFS
  CONNECTION "http://map.ns.ec.gc.ca/envdat/map.aspx?"
  PROJECTION
   "init=epsg:4326"
  END
  METADATA
   "wfs_request_method" "GET"
   "wfs_connectiontimeout" "60"
   "wfs_version" "1.0.0"
   "wfs_service" "WFS"
   "wfs_typename" "envirodat"
   "wfs_latlonboundingbox" "-64.6622 46.7594 -52.6808 55.2333"
  END
  CLASS
   NAME "Water Quality Monitoring Stations"
   COLOR 255 255 0
  END
 END

I get back the path to the resulting GML file as defined in http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/layerobj.

Hope this helps.

..Tom



-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org on behalf of Dzilberte Bekode
Sent: Wed 09-Jul-08 18:44
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] WFS-Mapscript
 
Hi everybody.
I'm trying to handle WFS with Mapscript but it's not working for me.
Output of the code below supose to be the name of the GML file, but it's only empty string. 
What's wrong??

CODE::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
<?php
 dl('php_mapscript.dll');  
 $map_path="/ms4w/apps/test/";
        
$map = ms_newMapObj($map_path."lol.map");
$kokot = $map->getLayerByName("MyWFS");
$GMLname= "= ".$kokot->executeWFSGetfeature()." =";
?>
<HTML>
   <HEAD>
     <TITLE>WFS-pokus</TITLE>
  </HEAD>
  <BODY>  
  <IMG SRC=<?php echo $image_url; ?> >
  <?php echo $GMLname; ?>
  </BODY>
 </HTML>


MAPFILE::::::::::::::::::::::::::::::

MAP
  NAME "demoPlugins"
  SIZE    600 400
  STATUS ON
  EXTENT -600000 -1334715 -159000 -1132715
  IMAGECOLOR 255 255 255
  UNITS METERS
  
  PROJECTION
    "init=EPSG:102067"
  END

   WEB
        IMAGEPATH "/ms4w/tmp/ms_tmp/"
        IMAGEURL "/ms_tmp/"
    METADATA
     "wfs_title" "msCross WFS Server" ## REQUIRED
     "wfs_onlineresource" "http://127.0.0.1/cgi-bin/mapserv?" ## Recommended
     "wfs_srs" "EPSG:102067 EPSG:3064 EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326" ## Recommended
     END 
    END
    
  LEGEND
    STATUS EMBED
    KEYSIZE 20 15
  END

  ##########
  # LAYERS #
  ##########
 
  
  LAYER 
   NAME "MyWFS"
  CONNECTIONTYPE postgis
         CONNECTION "user=JAVLLAR password=kreator host=localhost dbname=SlovGis"
        DATA "the_geom FROM setl"
   METADATA
   WMS_SRS "EPSG:28992"
       "wfs_title" "MyWFS"      ## REQUIRED
        "gml_featureid" "id" ## REQUIRED
       "gml_include_items" "id" ## Optional (serves all attributes for layer)
     END 
   DUMP TRUE       ## REQUIRED
   STATUS ON
   TYPE POINT
    CLASS 
    NAME "WFSvrstva"
   STYLE
         SIZE 5
         COLOR 0 0 0 
     END 
    END  
  END
  
END


Thanks for help.



      



More information about the mapserver-users mailing list