Hi
What is the "METADATA" part of the layer in your mapfile please ?
If you specified a result_fileds and result_header the 'id' has to be in
the list.
Is there a case sensitive problem ?
Le 02/04/2010 10:08, Medve Zsolt a écrit :
> Hy!
>
> I writing a plugin for Pmapper. I have a question about it. This is
> looks like the coordinates plugin,.. i click,then its display some results.
>
> In this case, i want to get the clicked shapes ID column value (this is
> not a shapefile ID or something like this, this is a custom ID column i
> made for the table)
>
> $shape-> values['ID'] contains nothing, empty string.I checked it (with
> echo). By the way the SOAP call returns a error code 5001, it mean that
> something is wrong. So because it only get an empty ID string..
>
> Why i get empty ID? is this code correct i paste?
>
> This is the code i writing:
>
> This will pass the $DempontJson to the Javascript file
>
> <?php
> // prevent XSS
> if (isset($_REQUEST['_SESSION'])) exit();
>
> session_start();
> require_once($_SESSION['PM_INCPHP'] . "/globals.php");
> require_once($_SESSION['PM_INCPHP'] . "/common.php");
>
> ini_set("soap.wsdl_cache_enabled", 0);
>
> $layer = $map->getLayerByName('sde1','sde2','sde3','sde4');
>
> // xy pix -> geo pt
>
> $xPixel = $_REQUEST['x'];
> $yPixel = $_REQUEST['y'];
>
> $xGeo = $_SESSION['GEOEXT']['minx'] +
> (($xPixel/$_SESSION['mapwidth']) *
> ($_SESSION['GEOEXT']['minx']-$_SESSION['GEOEXT']['maxx']));
> $yGeo = $_SESSION['GEOEXT']['maxy'] -
> (($yPixel/$_SESSION['mapheight']) *
> ($_SESSION['GEOEXT']['maxy']-$_SESSION['GEOEXT']['miny']));
>
> $pt = ms_newPointObj();
> $pt->setXY($xGeo, $yGeo);
>
> // proj
> $mapProjStr = $map->getProjection();
> $layerProjStr = $layer->getProjection();
> if ($mapProjStr&& $layerProjStr&& $mapProjStr != $layerProjStr) {
> $mapProjObj = ms_newprojectionobj($mapProjStr);
> $layerProjObj = ms_newprojectionobj($layerProjStr);
> $pt->project($mapProjObj, $layerProjObj);
> }
>
> // set map extent and size:
> $map->setExtent($_SESSION['GEOEXT']['minx'],
> $_SESSION['GEOEXT']['miny'], $_SESSION['GEOEXT']['maxx'],
> $_SESSION['GEOEXT']['maxy']);
> $map->setSize($_SESSION['mapwidth'], $_SESSION['mapheight']);
>
> $map->preparequery();
>
> // Use '@' to avoid warning if query found nothing
> @$layer->queryByPoint($pt, MS_SINGLE, -1);
> $pt->free();
>
> if ($layer->getNumResults() == 1) {
> $res = $layer->getResult(0);
> $layer->open();
> $shape = $layer->getFeature($res->shapeindex, $res->tileindex);
> $id = $shape->values['ID'];
> $layer->close();
> }
>
> try{
> $sClient = new SoapClient('http://IP:PORT/some?wsdl');
> $resp = $sClient->Dempont_fh_rtid(array($id));
>
> } catch(SoapFault $e){
> var_dump($e);
> }
>
> $dempont = round($resp);
>
> $DempontJson = "[";
> $DempontJson .= "{\"dempont\": $dempont,";
> $DempontJson = substr($DempontJson, 0, -1) . "]";
>
>
> header("Content-Type: text/plain; charset=$defCharset");
>
> // return JS object literals "{}" for XMLHTTP request
>
> echo "{\"DempontJson\": $DempontJson}";
>
> ?>
>
> The JS file:
>
> ...
>
> Dempont:
> {
> options: {css:{width:280}},
>
> /*
> * Dempont megjelenitö fv.
> */
> openDempontBox: function(imgxy) {
> var pixccoords = imgxy.split('+');
> var pixX = pixccoords[0];
> var pixY = pixccoords[1];
>
> var mpoint = PM.ZoomBox.getGeoCoords(pixX, pixY,
> false);
>
> $.ajax({
> url: PM_PLUGIN_LOCATION +
> '/dempont/x_dempont.php?' + SID + '&x=' + mpoint.x + '&y=' +
> mpoint.y,
> dataType: "json",
> success: function(response){
> var res = response.DempontJson;
> var restab = $('<table>');
> $.each(res, function(i, n){
>
> restab.append(($('<tr>').append($('<td>').html('Érték: ' +
> n.dempont))));
> });
> var container =
> $('#pmPluginCoordsDisplay').is(':visible') ?
> $('#pmPluginCoordsDisplay') :
> $('<div>').id('pmPluginCoordsDisplay')
> .addClass('pm-map-link')
>
> .addClass('pm-coordinates-dialog')
>
> .css(PM.Plugin.dempont.options.css)
> .appendTo('.ui-layout-center');
>
> container.html('')
> .html(_p('Dempont'))
> .append(restab)
> .append($('<img
> src="images/close.gif" alt="close" />').click(function ()
> {$(this).parent().remove();}).css('cursor','pointer'))
> .show();
> },
> error: function(XMLHttpRequest, textStatus,
> errorThrown) {
> alert('Hiba, Nem számolok neked!');
> }
> });
> }
> }
> });
>
> It is always jumps to the error:function(XML Http.....) :(
>
>
> Thanks,
> Zsolt
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> pmapper-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>
>
>
>
>
> __________ Information provenant d'ESET NOD32 Antivirus, version de la base
> des signatures de virus 4994 (20100402) __________
>
> Le message a été vérifié par ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
pmapper-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmapper-users