[ 
https://issues.apache.org/jira/browse/SEDONA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17551686#comment-17551686
 ] 

Jia Yu commented on SEDONA-126:
-------------------------------

Can you describe the error you have in details?

 

You can also try ST_AsEWKB https://sedona.apache.org/api/sql/Function/#st_asewkb

> 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
>            Priority: Major
>
> 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)

Reply via email to