Problem with layer.getExtent() and Oracle (MapScript Java)

Arkadi Shishlov arkadi at MEBIUS.LV
Mon May 28 06:49:47 PDT 2007


On Mon, 28 May 2007 15:32:01 +0300, Fernando Simon <fsimon at UNIVALI.BR> wrote:
>     I believe that the error is relate with your Data string.
>     Just few questions, why are you using "null" and "1=1"? Any special
> issue? What version of Oracle are you using? 8i? 9i? 10g?

Those were artifacts of dynamically constructed query. I cleaned them up, but the real difference was in specifying VERSION 10g (I use Express edition). After that, getExtent() returned valid answer.
I see getExtent() return extent in projection specified by SRID clause. Is it documented somewhere? While quite logical and understandable implementation, the MapScript documentation doesn't hint that map.setExtent(layer.getExtent()) may not work because (SHP based) MAP projection differs from this particular (database based) layer projection.

Thank you for the prompt response!


>     I suggest you to use this: (and add the version in the end)
>       sqlMapserverQuery = "L82GEOMETRY from (select L82GEOMETRY,
> DATASET82ID, L82C23T1, L82C12T1, L82C20T1, L82C24T1, L82C22T1, L82C21T1
> from DATASET82) USING UNIQUE DATASET82ID SRID 3059 VERSION 9i"
>     Best regards.
>
> --------------------------------------------------
> Fernando Simon
> UMN Mapserver and Oracle Spatial developer
> --------------------------------------------------
>
> Arkadi Shishlov wrote:
>> Calling extent = layer.getExtent() on the Oracle based layer returns rectObj with all components set to -1
>> extent => { 'minx': -1 , 'miny': -1 , 'maxx': -1 , 'maxy': -1 }
>>
>> The layer is created by
>>
>> sqlMapserverQuery = "L82GEOMETRY from (select null, L82GEOMETRY, DATASET82ID, L82C23T1, L82C12T1, L82C20T1, L82C24T1, L82C22T1, L82C21T1 from DATASET82 where 1 = 1) USING UNIQUE DATASET82ID SRID 3059"
>>
>> layer.setStatus(mapscriptConstants.MS_ON);
>> //layer.setType(MS_LAYER_TYPE.MS_LAYER_ANNOTATION);
>> layer.setType(MS_LAYER_TYPE.MS_LAYER_POINT);
>> layer.setConnectiontype(MS_CONNECTION_TYPE.MS_ORACLESPATIAL);
>> layer.setConnection(mapDataConnectionString);
>> layer.setData(sqlMapserverQuery);
>> layer.setStatus(visible ? 1 : 0);
>> layer.setTemplate("any.html");
>> layer.setProjection(dbProjection);
>>
>> I can sucessfully retrieve extent of SHP based layers. Also many other operations on the above mentioned Oracle layer works just fine.
>> I'm using Mapserver 4.10.1 from MS4W 2.2.3 on Windows XP, Sun Java 1.5.0_09, Tomcat 5.5.20.
>> Any hints? Is it a bug in my application or Mapserver?



More information about the MapServer-users mailing list