Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

How to develop a UDF that involves Vertica Spatial Data Types ?

We need to add few UDF that involves processing Geometry data types. For example, ST_My_Intersect (Geom1, Geom2). What should be the correct data type for the two input geometry types in my scalar UDF function ?  

I assume its either addVarbinary or addUserDefinedType(). but the real problem is how do we extract data points from the binary representation ?   


  • Hi Ablimit,

    It sounds like you are trying to interpret the internal representation of geometry data. Currently, we do not provide APIs to do that.

    If you have any other questions about HP Vertica Place or HP Vertica please let us know.


  • Hi Ablimit.

    If you're fine working with WKT/WKB directly, and alternative is to pass in those representations to your UDF as long varchar or long varbinary arguments in a nested function call fashion.
    Your query would become like:
      ST_My_Intersect (ST_AsText(Geom1), ST_AsText(Geom2))
    (Similarly for WKB.)

    Additionally, Place provides a few functions to access individual vertices of geometries.
    STV_PolygonPoint - for polygons and multi-polygons
    ST_X/ST_Y - for points

    Hope this helps.


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.