Sandro

checking the code for the query of WMS

...
$query_layers = $this->qLayer->getMetadata("wms_name");
$this->qLayer->set("connection", $this->qLayer->connection .
    "QUERY_LAYERS=" . $query_layers);
...

it looks for the METADATA tag "wms_name" defined for your layer. If it 
does not exist then the added URL tag "QUERY_LAYERS" will not have any 
value, and the server returns an exception. Please follow the 
recommendations for WMS client definition here:

http://mapserver.org/ogc/wms_client.html

It means add this to your layer definition

METADATA
   ...
   "wms_name" "0"
   ...
END

I can once also remove this additional QUERY_LAYERS since it seems not 
any more be required by MapServer working as WMS server (it was some 
time ago, though...). Or at least only apply if "wms_name" metadata exists.

Armin






On 01/02/2011 16:53, Sandro Ferrara tiscali wrote:
> Hi to all,
> i've a problem with the "identify" on a wms layers.
>
> When i try to use Identify on WMS layers i have this error log in
> pm_debug.log:
>
> [01-Feb-2011 16:40:10] P.MAPPER debug info
>    Validation of search.xml file succeeded
> [01-Feb-2011 16:40:25] P.MAPPER debug info
>    Validation of search.xml file succeeded
> [01-Feb-2011 16:40:35] P.MAPPER debug info
> dumpWMSQueryResults() - FeatureInfoURL:
>    
> http://88.53.214.52/sitr/services/WGS84_F33/PAI_f33/MapServer/WMSServer?QUERY_LAYERS=&LAYERS=0&REQUEST=GetFeatureInfo&SERVICE=WMS&FORMAT=image/png&STYLES=default&HEIGHT=434&QUERY_LAYERS=0&VERSION=1.1.1&SRS=EPSG:32633&WIDTH=912&BBOX=295293.620092379,4181873.2852194,384149.379907621,4224157.7147806&TRANSPARENT=TRUE&FEATURE_COUNT=10&INFO_FORMAT=MIME&X=390&EXCEPTIONS=application/vnd.ogc.se_xml&Y=132
> [01-Feb-2011 16:40:36] P.MAPPER debug info
> dumpWMSQueryResults() - Query Result:
>    Array
> (
>       [0] =>  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
>
>       [1] =>  <!DOCTYPE ServiceExceptionReport SYSTEM
> "http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd";>
>
>       [2] =>  <ServiceExceptionReport version="1.1.1">
>
>       [3] =>  <ServiceException code="InvalidFormat">
>
>       [4] =>  Can't parse XML request.
>
>       [5] =>  </ServiceException>
>
>       [6] =>  </ServiceExceptionReport>
>
> )
>
>
> my squery.php is:
>
> /**********************************************
>    *  QUERY RESULTS FOR WMS LAYER
>    **********************************************/
> class WMSQuery extends Query
> {
>       public function __construct($grp, $qLayer, $x_pix, $y_pix )
>       {
>           //$this->QUERY($qLayer);
>           $this->grp = $grp;
>           $this->qLayer = $qLayer;
>           $this->x_pix = $x_pix;
>           $this->y_pix = $y_pix;
>
>           // dump results to resultString
>           $this->dumpWMSQueryResults();
>       }
>
>
> function dumpWMSQueryResults()
>       {
>           // add QUERY_LAYER key to connection string as workaround for
> bug in MapScript
>           $query_layers = $this->qLayer->getMetadata("wms_name");
>           $this->qLayer->set("connection", $this->qLayer->connection .
> "QUERY_LAYERS=" . $query_layers);
>
>           $wmsResultURL =
> $this->qLayer->getWMSFeatureInfoURL($this->x_pix, $this->y_pix, 10, "MIME");
>           pm_logDebug(3, $wmsResultURL, "dumpWMSQueryResults() -
> FeatureInfoURL:");
>       if ($wmsResultURL == "") return;
>
>
>           // Check for availability of 'allow_url_fopen'
>           if (ini_get("allow_url_fopen")) {
>               $wmsResult = file($wmsResultURL);
>           // if no 'allow_url_fopen', use CURL functions to get Info URL
> content
>           } else {
>               if (!extension_loaded('curl')) {
>                   dl("php_curl." . PHP_SHLIB_SUFFIX);
>               }
>               ob_start();
>               $ch = curl_init($wmsResultURL);
>               curl_setopt($ch, CURLOPT_HEADER, 0);
>               curl_exec($ch);
>               curl_close($ch);
>               $wmsResult = preg_split("/\n/", ob_get_contents());
>               ob_end_clean();
>           }
>           pm_logDebug(3, $wmsResult, "dumpWMSQueryResults() - Query
> Result:");
>
>           $wmsNumRes = count($wmsResult);
>           if ($wmsNumRes>  5) {
>               $firstRun = 1;
>               $featureCount = 0;
>               $fldHeaderStr = "[\"#\",";
>               $resRowStr = "\"values\": [ [";
>               foreach ($wmsResult as $row) {
>                   if (preg_match ("/ServiceException/i", $row)) {
>                       return false;
>                   }
>                   if (preg_match ("/\sFeature\s/i", $row)) {
>                       $featureCount++;
>                       if (!$firstRun) {
>                           $resRowStr = substr($resRowStr, 0, -1);
>                           $resRowStr .= "],[";
>                       }
>                       $firstRun = 0;
>                       $resRowStr .= "\"w\",";
>                   } elseif (preg_match ("/\=/", $row)) {
>                       $resRowStr .= "";
>                       $resFld = preg_split ("/\=/", $row);
>                       if ($featureCount<  2) {
>                           $fldHeaderStr .= "\"" . trim($resFld[0]) . "\",";
>                       }
>                       $resRowStr .= "\"" .
> utf8_encode(trim(str_replace("'","",$resFld[1]))) . "\",";
>                   }
>               }
>
>               $fldHeaderStr = "\"header\": " . substr($fldHeaderStr, 0,
> -1) . "], \"stdheader\": " . substr($fldHeaderStr, 0, -1) . "], ";
>               $resRowStr = substr($resRowStr, 0, -1) . "]";
>
>               $this->numResults = $wmsNumRes - 4;
>               $this->colspan = $colspan;
>               $this->fieldHeaderStr = $fldHeaderStr;
>               $this->qStr = "$fldHeaderStr $resRowStr";
>           }
>       }
>
>
>
> } // end CLASS WMSQUERY
>
> and my map file is:
>
> LAYER
>           NAME "Bacini_Idrografici"
>           TYPE RASTER
>           STATUS DEFAULT
>           TEMPLATE void
>           CONNECTIONTYPE WMS
>           CONNECTION
> "http://88.53.214.52/sitr/services/WGS84_F33/PAI_f33/MapServer/WMSServer?";
>           METADATA
>               "DESCRIPTION" "PAI Bacini idrografici"
>               "ows_name" "0"
>               "wms_server_version" "1.1.1"
>               "ows_srs" "EPSG:32633"
>               "wms_format" "image/png"
>               "wms_style" "default"
>           END
>           METADATA
>               "ows_title" "Bacini Idrografici"
>           END
>           TRANSPARENCY 100
>           PROJECTION
>               "init=epsg:32633"
>           END
> END
>
>
> the environment, in which it occurs, is Ubuntu 9.10 + Pmapper-4.0
> 4.0.0.0 - BUILD 2009-12-19
>
> any solution?
>
> Thanks in advance,
> Sandro.
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> pmapper-users mailing list
> pmapper-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to