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 ?   

Comments

  • 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.


    -Casey



  • Ariel_CaryAriel_Cary Vertica Employee Employee

    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.

    Ariel

Leave a Comment

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