Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geotrellis-user] How to generate rasters from a CSV

Hi Arun,

You will need GeoTrellis / Raster / Interpolation ->

https://github.com/locationtech/geotrellis/blob/master/raster/src/main/scala/geotrellis/raster/interpolation/InverseDistanceWeighted.scala

I do not know of any projects off hand, but if anyone else on this list has an example, that would be very useful!


There was a question asked about CSV parsing in GeoTrellis on this mailing list before. This question was asked on this mailing list before. Below I have copied the answer. Let me know if this is useful for you.


---

There is no dedicated CSV parsing in GeoTrellis. I would guess that you have lat,lng + attributes in CSV format, in which case you would need to read and parse them as a normal CSV file then map over the result to create either Point of PointFeature from the fields as makes sense for that file.

As a basic example

val sc: SparkContext = ???

val lines: RDD[String] = sc.textFile("data.csv")
val points: RDD[PointFeature[String]] = lines.map { line =>
  val fields = lines.split(",")
  val point = Point(x = fields(0).toDouble, y = fields(1).toDouble)
  PointFeature(point, fields(2))
}

Just as an example though, split(",") won't handle quoted field values correctly.
In reality you would want to use a dedicated CSV parsing library.


On Fri, Jun 30, 2017 at 5:53 AM, Arun Natva <arun.natva@xxxxxxxxx> wrote:
Hi,
I have a requirement to implement an application using apache spark where I get the CSV data with Lat, Long along with other variables.
I have to generate a taster PNG file from this data and send back to the web application.

Could anyone please help me out which packages of GeoTrellis I would need and if you have any example projects that anyone had done before.

I can use either Scala or python (geopyspark).

Thanks,
Arun

Sent from my iPhone
_______________________________________________
geotrellis-user mailing list
geotrellis-user@locationtech.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geotrellis-user



--
Ross Bernet, Project Manager, GeoTrellis
Azavea | 990 Spring Garden Street, 5th Floor, Philadelphia, PA
rbernet@xxxxxxxxxx | office: 215.701.7717  | mobile: 858.692.1872

Azavea is a B Corporation - we apply geospatial technology for civic and social impact
while advancing the state-of-the-art through research. Join us.

On Fri, Jun 30, 2017 at 5:53 AM, Arun Natva <arun.natva@xxxxxxxxx> wrote:
Hi,
I have a requirement to implement an application using apache spark where I get the CSV data with Lat, Long along with other variables.
I have to generate a taster PNG file from this data and send back to the web application.

Could anyone please help me out which packages of GeoTrellis I would need and if you have any example projects that anyone had done before.

I can use either Scala or python (geopyspark).

Thanks,
Arun

Sent from my iPhone
_______________________________________________
geotrellis-user mailing list
geotrellis-user@locationtech.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/geotrellis-user



--
Ross Bernet, Project Manager, GeoTrellis
Azavea | 990 Spring Garden Street, 5th Floor, Philadelphia, PA
rbernet@xxxxxxxxxx | office: 215.701.7717  | mobile: 858.692.1872

Azavea is a B Corporation - we apply geospatial technology for civic and social impact
while advancing the state-of-the-art through research. Join us.

Back to the top