GithubHelp home page GithubHelp logo

Does GeoSpark have the function of changing the attribute value and adding attribute fields of each feature in Shapefile, in addition to spatial coordinates about sedona HOT 1 CLOSED

apache avatar apache commented on August 20, 2024
Does GeoSpark have the function of changing the attribute value and adding attribute fields of each feature in Shapefile, in addition to spatial coordinates

from sedona.

Comments (1)

jiayuasu avatar jiayuasu commented on August 20, 2024

GeoSpark now only supports reading shapes (in shx) and attributes (in dbf) from shapefiles (including shx and dbf) and doesn't support writing data back to shapefile. However, GeoSpark can write data to WKT and GeoJSON.

  1. After successfully loading shapefile into GeoSpark, every SpatialRDD has a method called SaveAsGeoJSON. You can call it like this:

myPointRDD.SaveAsGeoJSON(Disk/HDFS/OtherLocation);

GeoSpark JavaDoc has specified all APIs in GeoSpark: http://www.public.asu.edu/~jiayu2/geospark/javadoc/0.8.1/

  1. After successfully loading shapefile into GeoSpark, non-spatial attributes from DBF are merged to one big String and stored in UserData in each Spatial Object of SpatialRDD.

The RDD looks like this:

coordinate\tPhone1\tCountry1
coordinate\tPhone2\tCountry2
coordinate\tPhone3\tCountry3
coordinate\tPhone4\tCountry4

For example, after the loading, I want to filter out the objects that contain "phoneNumber:1234". The pseudo code is like this:

JavaRDD<Point> newSpatialRDD = myPointRDD.rawSpatialRDD.filter(
new FilterFunction(String s)
{
	List<String> attributes = s.split("\t");
	// Use "Tab" character to split the attributes because we merge them into one String
	if(attributes[0].contains("1234"))
	{
  		return true;
	}
	else
	{
		return false;
	}
}));

from sedona.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.