Mapscript 4.10/Oracle Spatial : GetShape and drawQuery problems

Aude Allain aude.allain.ext at MAPPY.COM
Fri Jan 19 11:30:37 EST 2007


Hello, 

GetFeature/GetShape :
--------------------

I found the GetFeature function on this page : http://mapserver.gis.umn.edu/docs/reference/mapscript/index_html. 


The tileindex of the objects are always equal at -1. So, when I call GetShape, the tileindex is always -1. 


queryByAttributes/DrawQuery:
----------------------------

I don't understand when you say "the object did you selected is inside of
the actual extent of the map when you draw the map?" . 

For me, the extent of the map which is displayed on the page has no link with my query. I just get the ID of the object to select in a text box, then I create a new mapobject, on which I execute the queryByAttributes function with the ID. Then, if I execute the drawquery function, the map extent must be automatically recalculated.

I tried to select the objects with an other field which contains 1 digit. I get the same result : the Image map is null but I have the selected objects the layer ($layer->getNumResults()). 

If I use draw instead of drawquery, the image map is not null but all the geomteries are yellow, it's the HILITE color defined in the mapfile. It's strange, isn't it ?

But if I can't use fields with less than 14 digits because soon I will have ID of 17 digits... 

Thanks of your help, 

aude




-----Message d'origine-----
De : UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] De la part de Fernando Simon
Envoyé : vendredi 19 janvier 2007 02:04
À : MAPSERVER-USERS at LISTS.UMN.EDU
Objet : Re: [UMN_MAPSERVER-USERS] Mapscript 4.10/Oracle Spatial : GetShape and drawQuery problems

Hi Aude,
    Sorry for the delay to reply your message. I'm out from the lab
and can't test here, I will go back to the lab just after the day 24
of January.
    About the error, the map (just draw from database) is working?
Another query function is working?
    I didn't found any reference to a GetFeature function the the
PHPMapscript reference
(http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/referencemanual-all-pages),
maybe the best way is the GetShape. Did you already tried with -1 as
tileindex parameter for getshape? 
    About the question #2, the object did you selected is inside of
the actual extent of the map when you draw the map?
    Another thing that can be relate with the both problem is the size
of your ID column, can you try with a type that is small than 14
digits, like 5 digits? Some problems was reported between the size of
some columns and the shapeindex (the place where the UNIQUE will be
stored). Can you try with a column with less digits?
    When I go back to the lab I will test, I can't test here and look
more deep in the maporaclespatial code.
    Best regards from Brazil.


-------------------------------------------
Fernando Simon
UMN Mapserver and Oracle Spatial developer
-------------------------------------------    
    

Citando Aude Allain <aude.allain.ext at MAPPY.COM>:

>  
> 
> Hello, 
> 
>  
> 
> Since I have installed the ms4w package, version 2.2.1, to have a
> compiled mapscript dll which supports oracle spatial, I have some
> problems with class methods. 
> 
>  
> 
> I use:
> 
> -          ms4w : php/mapscript_4.10.dll, php 5.2, Apache 2.2
> 
> -          Oracle Database 9.2
> 
> -          Oracle Client 10g
> 
>  
> 
> 1. GetFeature
> 
>  
> 
> I have posted a message, without response to date, about the
> getFeature
> function. When I use it, I get the following error : Fatal error:
> Call
> to undefined function getFeature(). I use it because getShape() is
> deprecated. And if I get shapeObj with getShape function I always
> get a
> null object. 
> 
>  
> 
> My code : 
> 
>             
> 
>                         $layer              = $map->GetLayerByName
> ($tab_layers[$i]);  
> 
>                         $selectedObj   =
> @$layer->queryByPoint($geoClic,
> MS_MULTIPLE, 1); 
> 
>                         $nbSelectedObj          =
> $layer->getNumResults();
> 
>                                                 
> 
>                         if ($nbSelectedObj == 0)
> 
>                         {
> 
>                                     continue ;
> 
>                         }
> 
>             
> 
>                         $layer->open();
> 
>                         $tabAttName = $layer->getItems();
> 
>                         $nbAttL                     =
> count($tabAttName);
> 
>                         
> 
>                         for ( $j=0 ; $j<$nbSelectedObj ; $j++) 
> 
>                         {          
> 
>                                    $object            =
> $layer->getResult ($j);
> 
>                                    if ( $object  == null ) echo
> "<br>objet NULL ";
> 
>  
> 
>                                    //$shapeObj     =
> $layer->getFeature($object->shapeindex);
> 
>  
> $layer->getShape($object->tileindex,$object->shapeindex);
> 
>  
> 
>                         ...  
> 
>  
> 
> In each class of my mapfile, there is the line TEMPLATE
> "ttt_query.html".
> 
>  
> 
>  
> 
>  
> 
> 2. queryByAttributes 
> 
>  
> 
> I call this function to get the object which has the 'ID' field and
> has
> the value '10400300001265'
> 
> $res = $layer->queryByAttributes'ID', 'ID=10400300001265',
> MS_MULTIPLE);
> 
>  
> 
> This call works, it permits to select the object in the layer
> because
> $layer->getNumResults() return 1.
> 
>  
> 
> Then, I want to display the result so I execute the DrawQuery
> function
> on my map Object. And the returned imageObj is always null.
> 
>  
> 
> Could you help me ? 
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Aude
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 




-------------------------------------------------
  Univali - Webmail - http://webmail.univali.br



More information about the mapserver-users mailing list