[ka-Map-users] Searching using kaMap

Paul Spencer pspencer at dmsolutions.ca
Fri Apr 21 07:42:48 EDT 2006


Ramesh,

the bounds of the shape should be a RectObj.  This means you can use  
the project() function to reproject it.

see: http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/ 
classes/rectobj

You would need to do something like:

$shp->bounds->project($oLayer->getProjection(),$oMap->getProjection());

I'm not sure if you can actually do this to a rectObj that is part of  
a shape.  To be safe, you can do this:

$rect = ms_newRectObj();
$rect->setExtent($shp->bounds->minx,$shp->bounds->miny,$shp->bounds- 
 >maxx,$shp->bounds->maxy);

$rect->project($oLayer->getProjection(),$oMap->getProjection());

Cheers

Paul

On 20-Apr-06, at 10:36 PM, ramesh karra wrote:

> Hi paul,
>
> Hope it is OK to send  this mail directly to you. If
> not, let me know, I will send this to mapservers list.
>
> I made some progress in writing in the php script to
> retrieve data from the dbf file. The data in the dbf
> file is in lat+long projection and I am different
> output projection to display the lines/points
> correctly. How do I get the data retrieved from the
> dbf file converted to  my output projection?
>
>    $oMap = ms_newMapObj($szMapFile);
>
>
>    $oLayer = $oMap->getLayerByName("mylayer");
>    $oLayer->queryByAttributes("Name", "xxxx",
> MS_SINGLE);
>
>    if ($oLayer->getNumResults() > 0) {
>       $r = $oLayer->getResult(0);
> 	$oLayer->open();
>       $shp = $oLayer->getShape($r->tileindex,
> $r->shapeindex);
>       $ext = $shp->bounds;
> 	$shp->free();
> 	$oLayer->close();
> 	
>       print $ext->minx;
>    }
>
> Basically, the above script works and prints the value
> but it is in lat+long projection (like 71.231789), I
> need to convert this to my output projection. I am
> hoping that there some function to do this because
> mapserver is already doing it while displaying my map.
>
> Thanks
> Ramesh
>
>
> --- Paul Spencer <pspencer at dmsolutions.ca> wrote:
>
>> Ramesh, there are soooo many!  I don't even know
>> where to start.  Try
>> googling php ajax and see what you get :)
>>
>> Cheers
>>
>> Paul
>>
>> On 13-Apr-06, at 7:00 PM, ramesh karra wrote:
>>
>>> Thanks for the quick reply paul!
>>>
>>> I am relatively new to both PHP and AJAX. To
>> achieve
>>> what you suggested, could you also suggest some
>> online
>>> tutorial/examples or books?
>>>
>>> Thanks again,
>>> Ramesh
>>>
>>> --- Paul Spencer <pspencer at dmsolutions.ca> wrote:
>>>
>>>> Ramesh,
>>>>
>>>> I would write a small php script to do the
>>>> interaction with the dbf
>>>> file and call it from my page using ajax.
>> Actually,
>>>> I'd use postgis
>>>> but that's another discussion ;)
>>>>
>>>> Cheers
>>>>
>>>> Paul
>>>>
>>>> On 13-Apr-06, at 6:47 PM, ramesh karra wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have 100s of points in shapefiles(.shp,.shx
>> and
>>>>> .dbf).
>>>>> that I use with my maps to show a place and
>> label
>>>> it.
>>>>> Is it possible to access the .dbf file in kaMap?
>>>>> I would like to implement a feature to search
>> for
>>>> a
>>>>> point and when a point of interest is found,
>> zoom
>>>> to
>>>>> that place. Is it possible to do this in kaMap
>>>> without
>>>>> having to create an XML file from .dbf file?
>>>>>
>>>>> Thanks
>>>>> Ramesh
>>>>>
>>>>>
>> __________________________________________________
>>>>> Do You Yahoo!?
>>>>> Tired of spam?  Yahoo! Mail has the best spam
>>>> protection around
>>>>> http://mail.yahoo.com
>>>>> _______________________________________________
>>>>> ka-Map-users mailing list
>>>>> ka-Map-users at lists.maptools.org
>>>>>
>>>>
>>>
>>
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>>>>
>>>>
>>>
>>
> +-----------------------------------------------------------------+
>>>> |Paul Spencer
>>>> pspencer at dmsolutions.ca   |
>>>>
>>>
>>
> +-----------------------------------------------------------------+
>>>> |Applications & Software Development
>>>>              |
>>>> |DM Solutions Group Inc
>>>> http://www.dmsolutions.ca/|
>>>>
>>>
>>
> +-----------------------------------------------------------------+
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Tired of spam?  Yahoo! Mail has the best spam
>> protection around
>>> http://mail.yahoo.com
>>
>>
> +-----------------------------------------------------------------+
>> |Paul Spencer
>> pspencer at dmsolutions.ca   |
>>
> +-----------------------------------------------------------------+
>> |Applications & Software Development
>>              |
>> |DM Solutions Group Inc
>> http://www.dmsolutions.ca/|
>>
> +-----------------------------------------------------------------+
>>
>>
>>
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list