You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by "libo zhang (Jira)" <ji...@apache.org> on 2022/06/07 03:29:00 UTC
[jira] [Created] (SEDONA-126) why always SpatialRDD saveAsWKB failed
libo zhang created SEDONA-126:
---------------------------------
Summary: why always SpatialRDD saveAsWKB failed
Key: SEDONA-126
URL: https://issues.apache.org/jira/browse/SEDONA-126
Project: Apache Sedona
Issue Type: Bug
Reporter: libo zhang
Hello author,I opened a csv file,and transform to spatialRDD , do nothing, save it failed
code is follow:
String layerName = "landuse";
String csvFilePath1 = "D:\\GCSResult\\landuse.csv";
DataFrameReader read1 = mSession.read();
read1.option("header", "true");
read1.option("delimiter", "%");
read1.format("csv");
Dataset<Row> rows1 = read1.load(csvFilePath1);
rows1.createOrReplaceTempView("landuse");
String s = "SELECT ST_GeomFromWKB(landuse.geometry) AS shape, landuse.id from landuse";
Dataset<Row> rows2 = mSession.sql(s);
rows2.createOrReplaceTempView("landuse");
rows2.printSchema();
System.out.println(rows2.count());
ArrayList<String> fieldNames = new ArrayList<>();
fieldNames.add("id");
fieldNames.add("shape");
Seq<String> fieldNameSeq = JavaConverters.asScalaIteratorConverter(fieldNames.iterator()).asScala().toSeq();
geometrySpatialRDD = Adapter.toSpatialRdd(rows2, "shape", fieldNameSeq);
int nn = geometrySpatialRDD.fieldNames.size();
geometrySpatialRDD.saveAsWKB("D:/GCSResult/landuse3");
--
This message was sent by Atlassian Jira
(v8.20.7#820007)