MapServer / MapServer-import

3 stars 2 forks source link

Direct feature access #1054

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: ivano.picco@aqupi.tk Date: 2004/11/11 - 11:12

Hi!,
I have try to use perl mapscript to get feature from Oracle Spatial without OGR,
but the method getFeature() it's not supported. Also I can't define any query
layer on Oracle Spatial native support.
Are there any plans to support it?
Thanks for your help,
Ivano Picco
tbonfort commented 12 years ago

Author: fsimon@univali.br Date: 2004/11/11 - 12:26

Yes, this feature has been implemented for the new version of
maporaclespatial.c. Now you can execute your query for one layer using Native
Support. You can use CGI mode and MapScript mode. I tested with CGI and
PHP/Mapscript modes.  
This new feature work like PostGis support. You can try this new release for the
new version of Mapserver (4.4). 
I don't know how perl mapscript work, but I believe that you can use functions
like queryByAttributes and queryByFeatures.
tbonfort commented 12 years ago

Author: ivano.picco@aqupi.tk Date: 2004/11/11 - 14:31

I try with mapserv 4.4.0-beta2 and it doesn't work. This is my request:
http://gisspeas2.csi.it:18091/cgi-bin/mapserv?map=/home/mapserver/dati/CTR/CTR.map&mode=itemnquery&qstring=//&qlayer=regione_SVG_SDO&qitem=OBJECTID
my browser display this message:
msOracleSpatialLayerWhichShapes(): OracleSpatial error. Error: ORA-00936:
missing expression . Query statement: SELECT rownum, OBJECTID, GEOMETRY FROM
regione WHERE AND SDO_FILTER( GEOMETRY, MDSYS.SDO_GEOMETRY(2003, NULL,
NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(313263,4879724,517049,5145994)
),'querytype=window') = 'TRUE' . Check your data statement.
This is my layer definition:
LAYER
    NAME regione_SVG_SDO
    STATUS ON
  CONNECTION "XX/XX@GEO"
  CONNECTIONTYPE oraclespatial
  DATA "GEOMETRY FROM regione"
    TYPE QUERY
    TEMPLATE county.svg
  METADATA
    WMS_TITLE "Regione SVG"
    WMS_ABSTRACT "Esempio per la generazione di SVG"
  END
END
If I try with OGR then the query works. 
Finally, what about getFeature() support on mapscript?
Thanks for you help,
Ivano Picco
tbonfort commented 12 years ago

Author: fsimon@univali.br Date: 2004/11/11 - 14:52

Hi, I didn't updat the HOWTO with the new specifications. Try to define this 
layer data:
DATA "GEOMETRY FROM regione USING UNIQUE <unique primary key>"
In your case:
DATA "GEOMETRY FROM regione USING UNIQUE OBJECTID"

I don't know perl functions. In PhpMapscript I can use querybyfeatures or 
querybyattributes.

Thanks
tbonfort commented 12 years ago

Author: ivano.picco@aqupi.tk Date: 2004/11/11 - 15:58

Hi,
Thank you very much, now mapserv works!
Another question: I have to define primary key on all oraclespatial layer?
The getFeature() method is a method define for the class layerObj. From the
mapscript.txt document:
getFeature(int shapeindex [, int tileindex ]): shapeObj_
Return the layer feature at *shapeindex* and *tileindex*
It works like getShape(int tileindex, int shapeindex). It think it's can be
defined as an alias of getShape() methods.
getFeature() is a method supported on shapefile, OGR and SDE access. I need it
because i have to load data from different sources, and it will be more simple
if i have just one function to get data.
getShape() is defined on PHP/mapscript. 
Thanks a lot,
Ivano Picco
tbonfort commented 12 years ago

Author: fsimon@univali.br Date: 2004/11/11 - 16:35

Ok, You need to define one primary key if you need to execute any query over 
the layer (like getFeature, querybyfeatures...). 
So, how do you use the getFeature?
Thanks for your help.
tbonfort commented 12 years ago

Author: ivano.picco@aqupi.tk Date: 2004/11/11 - 16:59

Sorry,
as you can read my english is bad,
I didn't explain clearly my question: If I define a generic oraclespatial layer
then can I specify a primary key to improve speed (when i get feature, perform a
query, or get a layer image)? Can I use it like the OCI_FID variable on OGR?
How do you get a sequential feature from a polygon layer when you draw an image?
What is the field used as index? 

I don't know very much the mapscript source code, I work on mapserver since one
month ago, but I can help you addin' mapscript SWIG support (and perl too) to
getFeature and getShape.
Thanks, 
Ivano Picco
tbonfort commented 12 years ago

Author: fsimon@univali.br Date: 2004/11/11 - 17:22

Ok, if you define one generic data statement you can define the primary key 
using the "using unique <pk>". So, when you don't define the primary key the 
code choose the "rownum" as index. 
I believe that the primary key have better performance when you execute any 
query function. When you only want draw a image the code need to draw and 
retrieve all geometrys that is inside of extent.
The code apply, for every shape (only for draw), SDO_FILTER operator that use 
the Oracle Spatial Index. So you need to specify you spatial index correctly 
for better performance.

Example of internal SQL when you don't define the primary key:
"select rownum ..." 

Example of internal SQL when you define the primary key:
"select <your primary key> ..."

Thanks.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/11/11 - 19:14

Hi all, this is Sean Gillies, the maintainer of Perl (and Python etc) mapscript.
Was just browsing through the new bugs.  The layerObj::getShape method in 
mapscript is for compatibility with old scripts only.  For new scripts, you
should always use layerObj::getFeature.

getFeature calls on msLayerGetShape(), so if this is implemented for Oracle
layers, you should be able to get oraclespatial features from Perl.
tbonfort commented 12 years ago

Author: ivano.picco@aqupi.tk Date: 2004/11/12 - 08:37

Ok Ok, I'm stupid or was only too much tired.
Today everything works well.
Thanks very much for your support,
Have a nice day!
Ivano