We have Java stored procedure in Oracle that make calls to functions offered by Oracle Spatial to perform spatial analysis and return results. I am looking to the same in PostGIS, is this possible?

1 Answer 1


Yes, of course, through JDBC. See the PostGIS manual for JDBC clients. You can even build custom spatial functions on the server that can be used through JDBC.

  • Thank you for your response. Can we store java in postgresql? Can we create use plsql function to call POSTGIS linearreferencing methods to get starting and ending milepoints etc.? May 22, 2012 at 21:43
  • There is PL/java, where you can write server-side procedural functions. However, PostGIS recently dropped their geometry support for PL/java, since it was not maintained. That's not to say you can't use it, just that you won't have access to the geometry object. You can still write something in PL/java to use linear referencing functions. Most folks use PL/pgSQL though.
    – Mike T
    May 22, 2012 at 21:59
  • I am interested in pure PLSQL functions to get result. Example would be providing x,y coordinates and geting nearest point on line, its length in miles, the line segments starting and ending mile point etc. I could see few linear refering methods in POSTGIS cheatsheet. I want to find out if we could simply use these methods to get results. Is is possible? May 23, 2012 at 19:47
  • PL/pgSQL is very similar to PLSQL, so a few modifications would be needed, but nothing massive. The functions in PostGIS should be able to do all of the tasks you seek, particularly with accessing x,y coordinate values, length functions and linear referencing functions. For example, see gis.stackexchange.com/questions/23493/…
    – Mike T
    May 23, 2012 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.