Skip to content

Conversation

MrPowers
Copy link
Collaborator

I'm trying to demonstrate how SedonaDB tracks CRSs and doesn't allow for operations with mismatched CRSs.

Doesn't look like this code is properly setting the CRS:

cities = sd.sql("""
SELECT * FROM (VALUES
    ('New York', ST_SetSRID(ST_GeomFromText('POINT(-8238310.24 4969803.34)'), 3857)),
    ('Los Angeles', ST_SetSRID(ST_GeomFromText('POINT(-13153204.78 4037636.04)'), 3857)),
    ('Chicago', ST_SetSRID(ST_GeomFromText('POINT(-9757148.04 5138517.44)'), 3857)))
AS t(city, geometry)""")
cities.schema
SedonaSchema with 2 fields:
  city: Utf8
  geometry: Binary

Let me know if you have any suggestions on how to fix the code!

@paleolimbot
Copy link
Member

Let me know if you have any suggestions on how to fix the code!

I believe this is caused by a DataFusion bug (all extension information in a VALUES clause are dropped). You should be able to work around this by moving the function call to the SELECT (also shorter!).

cities = sd.sql("""
SELECT city, ST_SetSRID(ST_GeomFromText(wkt), 3857) AS geometry FROM (VALUES
    ('New York', 'POINT(-8238310.24 4969803.34)'),
    ('Los Angeles', 'POINT(-13153204.78 4037636.04)'),
    ('Chicago', POINT(-9757148.04 5138517.44)'))
AS t(city, wkt)""")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants