<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Geometry Type not converted into proper binary format when reading through Federated Catalog in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/geometry-type-not-converted-into-proper-binary-format-when/m-p/135119#M50280</link>
    <description>&lt;P&gt;Give this a shot&lt;/P&gt;&lt;P&gt;Create a view in SQL Server that converts geometry to Well-Known Text before federating:&lt;/P&gt;&lt;P&gt;-- Create view in SQL Server&lt;BR /&gt;CREATE VIEW dbo.vw_spatial_converted AS&lt;BR /&gt;SELECT&lt;BR /&gt;id,&lt;BR /&gt;location_name,&lt;BR /&gt;location.STAsText() AS geom_wkt,&lt;BR /&gt;location.STSrid() AS srid,&lt;BR /&gt;location.AsBinaryZM() AS geom_wkb_zm, -- If you need Z/M coordinates&lt;BR /&gt;other_columns&lt;BR /&gt;FROM dbo.locations;&lt;/P&gt;&lt;P&gt;Then federate the view instead of the base table and convert in Databricks:&lt;/P&gt;&lt;P&gt;# In Databricks (requires DBR 17.1+ for native GEOMETRY support)&lt;BR /&gt;from pyspark.sql.functions import expr&lt;/P&gt;&lt;P&gt;df = spark.table("foreign_catalog.sqlserver_db.vw_spatial_converted")&lt;/P&gt;&lt;P&gt;# Convert WKT to native GEOMETRY type&lt;BR /&gt;df_spatial = df.withColumn(&lt;BR /&gt;"geometry",&lt;BR /&gt;expr("ST_GeomFromWKT(geom_wkt, CAST(srid AS INT))")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Now you can use Databricks spatial functions&lt;BR /&gt;result = df_spatial.where(&lt;BR /&gt;expr("ST_Within(geometry, ST_GeomFromWKT('POLYGON((...))', 4326))")&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Thu, 16 Oct 2025 13:25:49 GMT</pubDate>
    <dc:creator>AbhaySingh</dc:creator>
    <dc:date>2025-10-16T13:25:49Z</dc:date>
    <item>
      <title>Geometry Type not converted into proper binary format when reading through Federated Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/geometry-type-not-converted-into-proper-binary-format-when/m-p/122367#M46752</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When reading a geometry column from a sql server into Databricks through foreign/federated catalog the tranformation of geometry type to binary type is not in proper format or I am not able to find a way I can decode that binary.&lt;/P&gt;&lt;P&gt;for example, for point,&amp;nbsp;&lt;SPAN&gt;POINT (40.1150970058931 -8.3855249364345 30.3999996185303)&lt;/SPAN&gt;&lt;BR /&gt;I am getting the value as&amp;nbsp;&lt;SPAN&gt;5hAAAAENrI5DhmPFIMDVFqp/uw5EQAcAAGBmZj5A whereas I am expecting&amp;nbsp;AekDAADVFqp/uw5EQKyOQ4ZjxSDABwAAYGZmPkA=&lt;BR /&gt;&lt;BR /&gt;The value&amp;nbsp;AekDAADVFqp/uw5EQKyOQ4ZjxSDABwAAYGZmPkA=, I got when I read it using jdbc connection and querying the table as Shape.AsBinaryZM(), but in federated catalog I cannot define the query format or define a specific query.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Is there any way I can get proper binary into the geometry column&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jun 2025 15:24:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/geometry-type-not-converted-into-proper-binary-format-when/m-p/122367#M46752</guid>
      <dc:creator>shreya24</dc:creator>
      <dc:date>2025-06-20T15:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Geometry Type not converted into proper binary format when reading through Federated Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/geometry-type-not-converted-into-proper-binary-format-when/m-p/135119#M50280</link>
      <description>&lt;P&gt;Give this a shot&lt;/P&gt;&lt;P&gt;Create a view in SQL Server that converts geometry to Well-Known Text before federating:&lt;/P&gt;&lt;P&gt;-- Create view in SQL Server&lt;BR /&gt;CREATE VIEW dbo.vw_spatial_converted AS&lt;BR /&gt;SELECT&lt;BR /&gt;id,&lt;BR /&gt;location_name,&lt;BR /&gt;location.STAsText() AS geom_wkt,&lt;BR /&gt;location.STSrid() AS srid,&lt;BR /&gt;location.AsBinaryZM() AS geom_wkb_zm, -- If you need Z/M coordinates&lt;BR /&gt;other_columns&lt;BR /&gt;FROM dbo.locations;&lt;/P&gt;&lt;P&gt;Then federate the view instead of the base table and convert in Databricks:&lt;/P&gt;&lt;P&gt;# In Databricks (requires DBR 17.1+ for native GEOMETRY support)&lt;BR /&gt;from pyspark.sql.functions import expr&lt;/P&gt;&lt;P&gt;df = spark.table("foreign_catalog.sqlserver_db.vw_spatial_converted")&lt;/P&gt;&lt;P&gt;# Convert WKT to native GEOMETRY type&lt;BR /&gt;df_spatial = df.withColumn(&lt;BR /&gt;"geometry",&lt;BR /&gt;expr("ST_GeomFromWKT(geom_wkt, CAST(srid AS INT))")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;# Now you can use Databricks spatial functions&lt;BR /&gt;result = df_spatial.where(&lt;BR /&gt;expr("ST_Within(geometry, ST_GeomFromWKT('POLYGON((...))', 4326))")&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2025 13:25:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/geometry-type-not-converted-into-proper-binary-format-when/m-p/135119#M50280</guid>
      <dc:creator>AbhaySingh</dc:creator>
      <dc:date>2025-10-16T13:25:49Z</dc:date>
    </item>
  </channel>
</rss>

