栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

7. GeoMesa数据读取篇之本地文件读取

7. GeoMesa数据读取篇之本地文件读取

一. 简介
  1. 读取shapefile 单文件
  2. 读取shapefile 路径下的所有shapefile 文件
  3. 保持输出单shapefile 文件
  4. 保持输出shapefile 集合到指定文件路径
优化:
  1. 读取目录下说有shape为RDD
  2. 分区输出shapefiles时,先进行空间分区
二. 代码 1.本地Shapefile 文件读取
//读取shapefile
    def read_shapefile(shapePath: String, shapeName: String)(implicit sparkContext: SparkContext) = {
        var intpuParams: Map[String, String] = Map()
        var File = new File(shapePath)
        intpuParams += ("url" -> File.toURI.toURL.toString)
        intpuParams += ("geotools" -> "true")
        val query = new Query(shapeName)
        val inputRdd = GeoMesaSpark(intpuParams).rdd(new Configuration(), sparkContext, intpuParams, query)
        println(inputRdd.schema) //打印方案

        inputRdd
    }
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/283203.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号