mapserv segfaults trying to get thequery results of a native oracle spati

Nicol Hermann mapserver at GEOWORLD.DE
Mon May 2 09:43:34 EDT 2005


Hi Fernando,

thank you for your answer!
I found a problem in my code.
I opened the layer before i send the query. I changed this to:

$status = $Layer -> queryByPoint($geometrie, MS_MULTIPLE, 100);
$Layer->open();
for($j = 0;$j < $Layer->getNumResults(); $j++) {
   $oRes = $Layer->getResult($j);
   $shpobj = $Layer->getShape($oRes->tileindex,$oRes->shapeindex);
   $shpobj->free();
}
$Layer->close();

Now i get a mapserver error message:

Fatal error: [MapServer Error]: msOracleSpatialLayerGetShape(): Error:
ORA-01722: Ungultige Zahl . Query statement: SELECT ID, INFOTEXT,
BESCHRIFT, GEOMETRIE FROM (SELECT * FROM FLURST) WHERE ID = 0 .Check
your data statement.

Here is my data statement:
DATA "GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027"

The value of the variable '$oRes' are:

stdClass Object
(
    [shapeindex] => 0
    [tileindex] => -1
    [classindex] => 0
)

How do i have to change the data statement to get a valid shapeindex?

I'am not sure that the solution found for bug #1244 solves my problem
with the "--enable-point-z" flag. I use the latest cvs version which
should contain the fix, right?

Many thanks for your help
Nicol



Am Montag, den 02.05.2005, 09:59 -0300 schrieb Fernando Simon:
> Hi Nicol and Bart,
>     It's a strange problem for Linux box, what GCC are you using, 4.0?
>     I will check this problem, I saw a problem here with query's when I
> defined a filter parameter for my layer. But it isn't the problem in
> your case, or did you denine any filter for the layer in your mapscript?.
>     Here I used in a project this code to retrieve the data from Oracle
> layer:
> $camada->open();
> for($i = 0; $i < $total_results; $i++)
> {
>             $sindex = $camada->getResult($i);
>             $result = $camada->getShape(-1,$sindex->shapeindex);
>             if ($result->type == 0)
>             {
>                 $x = $result->bounds->minx;
>                 $y = $result->bounds->miny;
>                 $ponto_temp = ms_newpointObj();
>                 $ponto_temp->setXY($x, $y);
>                 if ($rectangle->contains($ponto_temp))
>                 {
>                     $arraytmp =
> array($result->values[$nm_campo_sel],$result->values[$desc]);
>                     array_push($resultado_selecao[$nm_campo_array],
> $arraytmp);
>                 }
>                 $ponto_temp->free();
>             }
>             else
>             {
>                 if(($rectangle->intersects($result) == MS_TRUE))
>                 {
>                     $arraytmp =
> array($result->values[$nm_campo_sel],$result->values[$desc]);
>                     array_push($resultado_selecao[$nm_campo_array],
> $arraytmp);
>                 }
>             }
>             $result->free();
> }
> $camada->close();
>
>     In this code I executed a "open" before retrieve the shapes ($camada
> is a layerobj). Did you execute this function before the getshape? (I
> used "-1" for tile index too).
>     The problem with Oracle Spatial and  "--enable-point-z" flag was
> solved, you can see this in #1244 Mapserver bugzilla.
>     Thanks.
>
> ------------------------------------------------------------------------
> Fernando Simon
> Mapserver and Oracle Spatial developer
> G10 - Laboratorio de Computacao Aplicada - Brazil
> http://g10.cttmar.univali.br - UNIVALI/CTTMAR
> ------------------------------------------------------------------------
>
>
> Nicol Hermann wrote:
>
> >Hi Bart,
> >
> >thanks again for your mail.
> >I changed the data statement one more time but unfortunately without
> >luck.
> >
> ><short gdb output>
> >
> >Program received signal SIGSEGV, Segmentation fault.
> >[Switching to Thread 16384 (LWP 8480)]
> >msOracleSpatialLayerGetShape (layer=0x8285d60, shape=0x82ff510,
> >record=0) at maporaclespatial.c:2003
> >2003        msOracleSpatialDataHandler *dthand =
> >(msOracleSpatialDataHandler *)layerinfo->oradatahandlers;
> >
> ></short gdb output>
> >
> >Yes i think Fernando needs to step in.
> >
> >Thanks again for your help
> >Nicol
> >
> >
> >Am Montag, den 02.05.2005, 11:23 +0200 schrieb Bart van den Eijnden:
> >
> >
> >>Hi Nicol,
> >>
> >>I have had similar crashes on Windows which were solved magically by compiling with Visual Studio 7 instead of 6. But for Fernando a similar situation on Linux worked fine.
> >>
> >>Can you try the following data statement as a last resort:
> >>
> >>DATA "GEOMETRIE from (SELECT ID, GEOMETRIE FROM FLURST) USING UNIQUE ID SRID 82027"
> >>
> >>That used to work for me on Windows even with Visual Studio 6, but then you miss a lot of attribute info ofcourse.
> >>
> >>Probably Fernando needs to step in and help, but in Brazil it is still quite early I guess :-)
> >>
> >>Best regards,
> >>Bart
> >>
> >>Bart van den Eijnden
> >>Syncera-ITSolutions
> >>Postbus 270
> >>2600 AG  DELFT
> >>
> >>tel.nr.: 015-7512436
> >>email: BEN at Syncera-ITSolutions.nl
> >>
> >>
> >>
> >>>>>Nicol Hermann <mapserver at geoworld.de> 05/02/05 11:17am >>>
> >>>>>
> >>>>>
> >>Hi Bart, Fernando, List
> >>
> >>thank you for your mail.
> >>I changed the DATA statement according to your advice.
> >>The statement is:
> >>DATA "GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027"
> >>
> >>Sadly this changes nothing. I further get a segfault.
> >>Attached the new gdb output:
> >>

<cut gdb output>

> >>
> >>
> >>Am Montag, den 02.05.2005, 10:57 +0200 schrieb Bart van den Eijnden:
> >>
> >>
> >>>Hi Nicol,
> >>>
> >>>In order to use query functionality you need to define a different DATA statement, something like:
> >>>
> >>>DATA "GEOMETRIE from (SELECT * FROM FLURST) USING UNIQUE ID SRID 82027"
> >>>
> >>>where ID is the name of your unique column (primary key most of the time).
> >>>
> >>>Best regards,
> >>>Bart
> >>>
> >>>Bart van den Eijnden
> >>>Syncera-ITSolutions
> >>>Postbus 270
> >>>2600 AG  DELFT
> >>>
> >>>tel.nr.: 015-7512436
> >>>email: BEN at Syncera-ITSolutions.nl
> >>>
> >>>
> >>>
> >>>>>>Nicol Hermann <mapserver at GEOWORLD.DE> 05/02/05 10:50am >>>
> >>>>>>
> >>>>>>
> >>>Hi Fernando,
> >>>
> >>>thank you very much for your e-mail.
> >>>I tried the latest CVS version ($Id: maporaclespatial.c,v 1.26
> >>>2005/04/28 22:19:41 rodrigo Exp $) with the '--enable-point-z-m'
> >>>compiling flag but it did not change the situation.
> >>>Mapserver crashes when it try to access the search results with:
> >>>
> >>>$shpobj = $Layer->getShape($oRes->tileindex,$oRes->shapeindex);
> >>>
> >>>I also found, that nearly the hole map-object is empty when i add the
> >>>'--enable-point-z-m' compiling flag (see attached gdb output) and try to
> >>>access it with PHP Mapscript.
> >>>
> >>>$map = ms_newMapObj('oracle_test_gk3.map') or die('Error.');
> >>>var_dump($map);
> >>>
> >>>Removing this flag gives me the normal look.
> >>>
> >>>Here is my oracle layer definition.
> >>>Yes i define a template, and no i did not define any filter parameter:
> >>>
> >>>LAYER
> >>>     NAME Oracle
> >>>     STATUS DEFAULT
> >>>     TYPE POLYGON
> >>>     DEBUG ON
> >>>     CONNECTIONTYPE oraclespatial
> >>>     CONNECTION "user/passwd at BOX.os"
> >>>     DATA "GEOMETRIE from FLURST USING SRID 82027"
> >>>     PROJECTION
> >>>       "init=epsg:31467"
> >>>     END
> >>>     CLASS
> >>>        NAME gw
> >>>        TEMPLATE "dummy.html"
> >>>        STYLE
> >>>           COLOR 192 192 192
> >>>           OUTLINECOLOR 0 0 0
> >>>        END
> >>>     END
> >>>  END
> >>>
> >>>
> >>>Should i open a bug on this?
> >>>Many thanks
> >>>Nicol
> >>>
> >>>
> >>>gdb-Output:
> >>>
> >>>
> >>>
> >><cut old gdb output>
> >>
> >>
> >>
> >>>Am Donnerstag, den 28.04.2005, 11:42 -0300 schrieb Fernando Simon:
> >>>
> >>>
> >>>>Hi Nicol,
> >>>>    This problem can be a bug in maporaclespatial.c in 4.4.2 version.
> >>>>In this version of Mapserver the maporaclespatial is a 1.16 version,
> >>>>a old version (now it is a 1.25). I fixed some problems with OCI
> >>>>handlers between 1.6 and 1.25, the last version 1.25 can work
> >>>>correctly for you.
> >>>>    But, it's a strange problem, how did you define oracle spatial
> >>>>layer? Did you define the template for the layer? Did you define any
> >>>>filter parameter for the layer?
> >>>>    Thanks.
> >>>>
> >>>>ps: for cvs version specify the --enable-point-z-m flag
> >>>>
> >>>>------------------------------------------------------------------------
> >>>>Fernando Simon
> >>>>Mapserver and Oracle Spatial developer
> >>>>G10 - Laboratorio de Computacao Aplicada - Brazil
> >>>>http://g10.cttmar.univali.br - UNIVALI/CTTMAR
> >>>>------------------------------------------------------------------------
> >>>>
> >>>>Citando Nicol Hermann <mapserver at GEOWORLD.DE>:
> >>>>
> >>>>
> >>>>
> >>>>>Dear list,
> >>>>>
> >>>>>I want to use the query function of the native Oracle Spatial
> >>>>>support
> >>>>>(INPUT=ORACLESPATIAL) from mapserver 4.4.2.
> >>>>>Displaying the image is no problem but when try to get the query
> >>>>>results
> >>>>>mapserver crashes with a segmentation fault.
> >>>>>
> >>>>>Here is what i try to do:
> >>>>>
> >>>>>for($j = 0;$j < $Layer->getNumResults(); $j++) {
> >>>>>  $oRes = $Layer->getResult($j);
> >>>>>  $shpobj = $Layer->getShape($oRes->tileindex,$oRes->shapeindex);
> >>>>>// <-
> >>>>>Line which causes the Segmentation fault
> >>>>>  $shpobj->free();
> >>>>>}
> >>>>>
> >>>>>Is this a bug or do i have to change something?
> >>>>>My system is:
> >>>>>Debian sarge, mapserver 4.4.2 (php Mapscript), oracle 10g
> >>>>>
> >>>>>Attached you find the output of gdb.
> >>>>>
> >>>>>
> >>><cut old gdb output>

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



More information about the mapserver-users mailing list