Re: Miss Shapefile fields Using Adapter.toDf(spatialRDD, spark)

30 views
Skip to first unread message

Jia Yu

unread,
Jul 2, 2018, 2:18:40 AM7/2/18
to Zhou Wu, GeoSpark Discussion Board
Hi Zhou,

The shapefile field names are currently missing in GeoSpark. I am working on the implementation of that. The DataFrameFactory implementation is not stable yet. We will provide a stable API soon.

Thanks,
Jia

------------------------------------

Jia Yu,

Ph.D. Student in Computer Science



On Fri, Jun 29, 2018 at 1:29 PM Zhou Wu <zwu...@gmail.com> wrote:

I looked at this example: http://datasystemslab.github.io/GeoSpark/api/sql/GeoSparkSQL-Constructor/, I would expect the the fields of _c1, _c2...for the feature such as
REGION, GEOID, .... in the dataframe, why does  it just give the 'rddshape'? How can I get a dataframe including all the feature fields?  The shape file I used is from https://catalog.data.gov/dataset/tiger-line-shapefile-2017-nation-u-s-current-state-and-equivalent-national.


 


Enter code here...



String shapefileInputLocation = "...\tl_2017_us_state.shp";
           
         
       
JavaSparkContext jsc = new JavaSparkContext(spark.sparkContext());
       
SpatialRDD<Geometry> spatialRDD = new SpatialRDD<Geometry>();

       
        spatialRDD
.rawSpatialRDD = ShapefileReader.readToGeometryRDD(jsc, shapefileInputLocation);
       
//spark.udf().register("test", new FeaturePolygon(), DataTypes.)
       
Geometry g = spatialRDD.rawSpatialRDD.first();
       
       
       
       
System.out.println("======++" + g.toString().substring(g.toString().length() - 300));

       
//if (true) System.exit(1);

       
Dataset<Row> shapefileDf = Adapter.toDf(spatialRDD, spark);

        sharefileDf
.show();



--
You received this message because you are subscribed to the Google Groups "GeoSpark Discussion Board" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geospark-discussio...@googlegroups.com.
To post to this group, send email to geospark-dis...@googlegroups.com.
Visit this group at https://groups.google.com/group/geospark-discussion-board.
To view this discussion on the web visit https://groups.google.com/d/msgid/geospark-discussion-board/b73338d5-668b-482d-984d-85a303bab24c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages