Search the closest thing

4 messages Options
Embed this post
Permalink
Gérald Quintana

Search the closest thing

Reply Threaded More More options
Print post
Permalink
Hello,

I have a table containing Point geometries. How can I search for the
closest element for a given point. In pure SQL, I tried:
select e.id, e.name, e.geom,
Distance(e.geom,GeomFromText('POINT(... ...)',4326)) as distance
from equipment e
where e.geom && GeomFromText('POLYGON((...))',4326))
order by distance asc
limit 1

How can I do this with Hibernate Spatial?

Cheers,
Gerald
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Ghutake, Dinesh

Hibernate spatial issue - coun't insert valid data into sdo columns

Reply Threaded More More options
Print post
Permalink
Hi,

I am trying with hibernate spatial example given in tutorial.

I could able to run the example, but not able to insert valid data into
the SDO filed.

1)       I created table called EVENTS:

CREATE TABLE EVENTS

(

   EVENT_ID decimal(19) PRIMARY KEY NOT NULL,

   EVENT_DATE timestamp,

   TITLE varchar2(255),

   LOC SDO_GEOMETRY

)

 

2)       create hibernate project as mentioned in the tutorial.

Hbm entrty : <property name="location"

                  type="org.hibernatespatial.GeometryUserType">

            <column name="LOC" sql-type="MDSYS.SDO_GEOMETRY"/>

                </property>

   

3) Ant command : $ ant run -Daction=store -Dgeom="POINT(10 15)"

4) Inserted on row in db , but with LOC value = <Unknown(2,002)>
instead of  POINT(10 15).

 

Could you please help me to find out what am I missing?

 

Many Thanks

Dinesh Ghutake


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Karel Maesen

Re: Hibernate spatial issue - coun't insert valid data into sdo columns

Reply Threaded More More options
Print post
Permalink
Hi,


What version of Oracle are you using? Have you tried inserting a  
point feature manually (see the Oracle Spatial manual on how to do  
that)?

Could you activate the sql logging in Hibernate (setting  
"hibernate.show_sql" to "true"  in the Hibernate properties file  
(hibernate.cfg.xml), and post the SQL Insert statements?

On 10 Apr 2008, at 19:00, Ghutake, Dinesh wrote:
>
> 4) Inserted on row in db , but with LOC value = <Unknown(2,002)>
> instead of  POINT(10 15).
>

Are you reporting an error, or the output of an SQL select statement  
on the events table? In case it's an error, could you post the full  
stack trace?


Regards,

Karel Maesen


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Ghutake, Dinesh

Re: Hibernate spatial issue - coun'tinsert valid data into sdo columns

Reply Threaded More More options
Print post
Permalink
Hi Karel,
Thank you very much for your response.
Sorry for late reply I was out of office on vacation.
I have tried now as per your suggestions and happened to learn that the
sql client (Squirrel) is not compatible to read spatial data types.
I tried to retrieve from sql plus I could able to retrieve data
successfully.

Thank you,
Dinesh Ghutake

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On
Behalf Of Karel Maesen
Sent: Thursday, April 10, 2008 2:59 PM
To: Hibernate Spatial Users Discussion
Subject: Re: [hibernatespatial-users] Hibernate spatial issue -
coun'tinsert valid data into sdo columns

Hi,


What version of Oracle are you using? Have you tried inserting a  
point feature manually (see the Oracle Spatial manual on how to do  
that)?

Could you activate the sql logging in Hibernate (setting  
"hibernate.show_sql" to "true"  in the Hibernate properties file  
(hibernate.cfg.xml), and post the SQL Insert statements?

On 10 Apr 2008, at 19:00, Ghutake, Dinesh wrote:
>
> 4) Inserted on row in db , but with LOC value = <Unknown(2,002)>
> instead of  POINT(10 15).
>

Are you reporting an error, or the output of an SQL select statement  
on the events table? In case it's an error, could you post the full  
stack trace?


Regards,

Karel Maesen


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatia
l-users
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users