I am using jts geometry object to store my geometry objects as an Oracle SDO_Geometry. However when I want to use SDO_GEOM.RELATE methods they are not working properly,I realized that I need to create a spatial index but dont know how to do with hibernate. Do you know any annotation for this problem.
@Type(type="org.hibernate.spatial.GeometryType")
private Geometry area;
Well, just create the index on the table where you store those geometries. Use SQL for that.
You need also (before you create the index) to add the proper metadata so that the index creation has the proper information it needs (coordinate system, bounds, tolerance). For example, assuming your geometries are in WGS84 coordinates:
insert into user_sdo_geom_metadata (table_name, column_name, diminfo, srid)
values (
'US_CITIES',
'GEOMETRY',
sdo_dim_array (
sdo_dim_element('long', -180.0, 180.0, 0.5),
sdo_dim_element('lat', -90.0, 90.0, 0.5)
),
4326
);
commit;
Then create the index:
create index us_cities_sx on us_cities (geometry)
indextype is mdsys.spatial_index;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With