egorov-viadukt opened a new issue, #1126: URL: https://github.com/apache/sedona/issues/1126
Within my scenario, I am trying to reproduce one of the already running use-cases in our company. For this, we use GeoPandas to import GeoJson files. It worked well following the examples in Sedona documentation. However, when I tried to import a file with different geometry types, I find that Spark can't handle different types out of json. I would be very thankful for your help. ## Expected behavior Following [this example](https://sedona.apache.org/1.5.0/tutorial/sql/#load-geojson-using-spark-json-data-source ), I was expecting to retrieve "similar" outcome as in GeoPandas. ## Actual behavior Following the above tutorial, I get back an empty dataframe. ## Steps to reproduce the problem Code that I use here: ``` schema = "type string, name string, features array<struct<type string, geometry string, properties map<string, string>>>" (sedona.read.json(geojson_path, schema=schema) .selectExpr("explode(features) as features") # Explode the envelope to get one feature per row. .select("features.*") # Unpack the features struct. .withColumn("geometry", F.expr("ST_GeomFromGeoJSON(geometry)")) # Convert the geometry string. .show()) ``` You can try importing the following example/excerpt: ``` { "type" : "FeatureCollection", "name" : "Gebaeude_EPSG4326_JSON", "features" : [ { "type" : "Feature", "geometry" : { "type" : "Polygon", "coordinates" : [ [ [ 7.2746115909, 51.2778283936 ], [ 7.2747184496, 51.2778641239 ], [ 7.2746658893, 51.2779260031 ], [ 7.2745578156, 51.2778897872 ], [ 7.2745763052, 51.2778681619 ], [ 7.2746105856, 51.277828055 ], [ 7.2746115909, 51.2778283936 ] ] ] }, "properties" : { "UUID" : "DENW29AL1K70001n", "GEB_TYP" : "Hauptgebäude", "GEB_FKT" : "Wohnhaus", "GEB_NAME" : "", "BAUWEISE" : "", "DACHFORM" : "", "GEB_ZUS" : "", "GRUNDFL" : "67", "FLAECHE" : 66.6, "OEFFENTL" : "nein", "LAGE" : "" } }, { "type" : "Feature", "geometry" : { "type" : "Polygon", "coordinates" : [ [ [ 7.2746115909, 51.2778283936 ], [ 7.2747184496, 51.2778641239 ], [ 7.2746658893, 51.2779260031 ], [ 7.2745578156, 51.2778897872 ], [ 7.2745763052, 51.2778681619 ], [ 7.2746105856, 51.277828055 ], [ 7.2746115909, 51.2778283936 ] ] ] }, "properties" : { "UUID" : "DENW29AL1K70001n", "GEB_TYP" : "Hauptgebäude", "GEB_FKT" : "Wohnhaus", "GEB_NAME" : "", "BAUWEISE" : "", "DACHFORM" : "", "GEB_ZUS" : "", "GRUNDFL" : "67", "FLAECHE" : 66.6, "OEFFENTL" : "nein", "LAGE" : "" } }, { "type" : "Feature", "geometry" : { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 7.1199865419, 51.2762210321 ], [ 7.119988913, 51.2762184442 ], [ 7.1199865563, 51.2762210323 ], [ 7.1199865419, 51.2762210321 ] ] ], [ [ [ 7.1199865419, 51.2762210321 ], [ 7.1199159896, 51.276298148 ], [ 7.1198254916, 51.2762646788 ], [ 7.11981461, 51.2762765908 ], [ 7.1197230484, 51.2762424839 ], [ 7.1198144632, 51.2761421862 ], [ 7.1198779945, 51.276165033 ], [ 7.1198664749, 51.2761771236 ], [ 7.1199865419, 51.2762210321 ] ] ] ] }, "properties" : { "UUID" : "DENW29AL1000Fprz", "GEB_TYP" : "Hauptgebäude", "GEB_FKT" : "Wohnhaus", "GEB_NAME" : "", "BAUWEISE" : "Reihenhaus", "DACHFORM" : "", "GEB_ZUS" : "", "GRUNDFL" : "nicht belegt", "FLAECHE" : 164.7, "OEFFENTL" : "nein", "LAGE" : "" } }, { "type" : "Feature", "geometry" : { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 7.1199865419, 51.2762210321 ], [ 7.119988913, 51.2762184442 ], [ 7.1199865563, 51.2762210323 ], [ 7.1199865419, 51.2762210321 ] ] ], [ [ [ 7.1199865419, 51.2762210321 ], [ 7.1199159896, 51.276298148 ], [ 7.1198254916, 51.2762646788 ], [ 7.11981461, 51.2762765908 ], [ 7.1197230484, 51.2762424839 ], [ 7.1198144632, 51.2761421862 ], [ 7.1198779945, 51.276165033 ], [ 7.1198664749, 51.2761771236 ], [ 7.1199865419, 51.2762210321 ] ] ] ] }, "properties" : { "UUID" : "DENW29AL1000Fprz", "GEB_TYP" : "Hauptgebäude", "GEB_FKT" : "Wohnhaus", "GEB_NAME" : "", "BAUWEISE" : "Reihenhaus", "DACHFORM" : "", "GEB_ZUS" : "", "GRUNDFL" : "nicht belegt", "FLAECHE" : 164.7, "OEFFENTL" : "nein", "LAGE" : "" } } ] } ``` ## Settings I use the docker image with latest sedona version. Environment = Standalone -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@sedona.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org