1) send coordinates from js to PHP: plugins/coordinates/coordinates.js

2) convert coordinates: plugins/coordinates/x_coords.php

3) many options:
    3a) search via pgsql: see plugins/digitizepoints/*

    3b) or use pmapper/incphp/x_ajax/x_info.php and use 
json_decode($queryResult) to find your results indexes (search for 
"shpindex" in the code for instance)

    3c) copy / paste and modify the incphp/query/search.php and 
incphp/query/query.php

    3d) search the shapes with mapscript 
(http://mapserver.org/mapscript/index.html ) like in this quick and 
dirty example:
// prevent XSS
if (isset($_REQUEST['_SESSION'])) exit();

session_start();
require_once($_SESSION['PM_INCPHP'] . '/globals.php');
require_once($_SESSION['PM_INCPHP'] . '/common.php');

$layer = $map->getLayerByName('YOUR_LAYER_NAME');

// xy pix -> geo pt
$imgxy = $_REQUEST['imgxy'];
$tmp = explode('+', $imgxy);
$xPixel = $tmp[0];
$yPixel = $tmp[1];
$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();

// read results:
if ($layer->getNumResults() == 1) {
    $res = $layer->getResult(0);
    $layer->open();
    $shape = layer->getFeature($res->shapeindex, $res->tileindex);
   
    // use $shape->values to read what you want
// ......
    $layer->close();
}



Medve Zsolt a écrit :
> thanks for the answer, but: how ?
>
> "You have to send them to your PHP file, convert the click in map unit, 
> use PHP mapscript to project coordinates, search the shapes, and call 
> tour SOAP service. "
> This is the part what i cant do :)
>
> Send the mouse click coordinates to the php file ( witch contains the 
> SOAP call),converting clicking,search the shape..
> The SOAP call is ready to use,but it expect the id atribute form the 
> shape file..How can i pass it to them?
>
> 2010.03.22. 11:21 keltezéssel, Thomas Raffin írta:
>   
>> Hi
>>
>> Medve Zsolt a écrit :
>>     
>>> Hy!
>>>
>>> I would like to ask some qouestion about p.mapper logics.
>>> 1. I see that the line in js_config.php :
>>>         {tool:'identify',      name:'Identify'}, is for the button to 
>>> apear in Tools. But where is the code of the image. Where and how it 
>>> will get the icon for the toolbar? I cant follow the logic. ( I need 
>>> this because if i want a custom functionality to pmapper, i want a 
>>> custom icon too, but if i write a button line to the js_config.php 
>>> just the text appears only.)
>>>
>>>       
>> The "tool" indicates image name.
>> In config/xxxxx/js_config.php you can specify the images theme and 
>> extension to use :
>> "PM.buttonsDefault = {
>>    toolbarid:'toolBar',
>>    options: {orientation:'v',
>>              css:{height:'auto'},
>>              theme:'theme2',
>>              imagetype:'gif'
>>             },
>> ........"
>>
>> Here "theme2" and "gif". The buttons images are calculated in 
>> pmapper/javascript/src/pm.uielements.js: image url = 
>> 'images/buttons/'+ options.theme + '/' + tool + '_off.' + 
>> options.imagetype.
>> For instance: pmapper/images/buttons/theme2/yourtool_off.gif
>>
>>     
>>> 2. How p.mapper gets the id of a shape? I mean if i have a 
>>> something.shp file and have 1 or more shapes in it, how can i use for 
>>> my own functionality the ID of a shape?
>>> I need to pass this ID to a Soap Call.
>>>
>>>       
>> I don't really know what you want to do.
>>
>> If you want to click on the map, find the shapes, call a SOAP service, 
>> you have to know PHP mapscript 
>> (http://mapserver.org/mapscript/index.html)
>>
>> There are js functions ending with "_start(imgxy)". (see 
>> http://svn.pmapper.net/trac/wiki/FaqCustomizations#AddingaplugintotheGUI 
>> to know how to integrate your plugin). It will give you the xy 
>> coordinates (screen unit) of your click. You have to send them to your 
>> PHP file, convert the click in map unit, use PHP mapscript to project 
>> coordinates, search the shapes, and call tour SOAP service.
>>
>>     
>>> Can someone help me a little bit more? I  would be gratefull.
>>>
>>> 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
>>> pmapper-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>>>
>>>
>>>
>>>
>>>
>>>       
>
>
> ------------------------------------------------------------------------------
> 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
> pmapper-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>
>
>
>
>
>   
------------------------------------------------------------------------------
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
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to