Google's Encoded Polyline Algorithm Format is implemented in several GI tools. PostGIS e.g. has ST_AsEncodedPolyline and ST_LineFromEncodedPolyline functions.

In contrast, Oracle Database has no corresponding functions. Neither in the Locator module, which is part of the regular license, nor in the Spatial&Graph extension.

Is there an implementation of Google's polyline encoding algorithm for Oracle?

The algorithm is well documented, but not trivial to implement because it uses some bit operations (which are part of nearly every programming language, but not of Oracle SQL resp. PL/SQL).

  • 2
    That is correct. Oracle does not offer this out of the box. Implementing it is doable via Java. Meaning that if a java library exists that performs that encoding, it is easy to load it into your Oracle database and invoke it via a PL/SQL wrapper. Jan 23, 2019 at 8:57
  • What would you use this encoding for ? Would you store the geometries in the database in the encoded format ? Or would it be used as an exchange format - a bit like GeoJSON, GML, KML or WKT ? Jan 23, 2019 at 9:01
  • @AlbertGodfrind yes, I would use it as an exchange format. Thanks for the hint to Java - I haven't used Java in Oracle yet, but maybe will have a look at this.
    – Mesa
    Jan 23, 2019 at 9:24
  • 1
    Let me know when you want to try the java approach. If you can find a java library that does the transformation from/to the Google encoding, I can take a look and try implementing it. The principle is to: (1) load the java library (the jar file) via a command line or PL/SQL procedure (2) write a static java class/method that invokes the methods exposed in the java library and load that in the database as well, and finally (3) write a PL/SQL wrapper that invokes the proper static methods. Jan 23, 2019 at 9:46
  • 1
    It turns out that Oracle has implemented this transformation - only it is not available yet in any shipping version. Current thought is to include it in 20c. Jan 31, 2019 at 12:55

1 Answer 1


According to Albert Godfrind's comment: the feature is planned for Oracle 20c

Your Answer

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

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