Can Ortus ORM Extension support spatial column format?

Can Ortus ORM Extension support spatial column format?

hibernate-spatial

best asked over on their forum https://community.ortussolutions.com/

Hey @gaia-jyh ,

The extension does not currently support or work with hibernate-spatial in any way. I wouldn’t be opposed to adding this, though I have little experience with hibernate-spatial so I’m not clear on what you need. Would you mind posting more details about your use case and example code?

One other note is that I’d prefer to add hibernate-spatial via a separate extension, to mimic Hibernate’s own organization and keep the core ORM extension nice and lightweight.

1 Like

Hi @michaelborn_me,
Thank you for your response. I’m interested in using spatial data with the Ortus ORM Extension, specifically with support for GeoJSON or WKT formats.
In my use case, I have a PoliceStation.cfc component with several properties, including a geometry_4326 property where I’d like to store spatial data.
how to use EntityNew、EntitySave ?

data in postgis

CREATE TABLE PoliceStation(
    ogc_fid SERIAL PRIMARY KEY,
    tid VARCHAR(255),
    road_name VARCHAR(255),
    geometry_4326 geometry(Geometry, 4326)
);

PoliceStation.cfc

component persistent="true"{
    property name="ogc_fid"  fieldtype="id"  generator="increment";
    property name="tid" fieldtype="Column"  type="string" ;
    property name="road_name" fieldtype="Column"  type="string" ; 
    property name="geometry_4326" formula="ST_AsText(geometry_4326)" fieldtype="Column"  type="string" ;
}

use sql

INSERT INTO locations (tid,road_name, geometry_4326)
VALUES ('1','Sample Location', ST_GeomFromText('POINT(-97.0533395929335 35.52863966771345)'));

use orm

// Create a new instance of the PoliceStation entity
var newPoliceStation = EntityNew("PoliceStation");

// Set the property values for the new entity
newPoliceStation.setTid("1");
newPoliceStation.setRoad_name("Sample Location");
newPoliceStation.setGeometry_4326("POINT(-97.0533395929335 35.52863966771345)");

// Save the entity to the database
EntitySave(newPoliceStation);
1 Like

Ok, that’s a good start for seeing what you want to do. I’ll add this to our issue tracker so you can keep up with what’s going on.

As far as your question… :man_shrugging: You might be able to get this working through heavy use of formula properties, per your example. If not, there’s not much I can do short of implementing hibernate-spatial support… since, as I said, this is not currently supported.

I wrote this up here, so it won’t get lost in the shuffle. I can’t promise anything, but I will
certainly research the level of effort required.

https://ortussolutions.atlassian.net/browse/OOE-8

1 Like