package com.huachongrizhao.readjsonfile;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* @author 花重日照
* @date 2018年3月24日 下午1:05:28
* @Comments
*/
public class ReadGEOJSONFile {
public void readJson(String filepath) {
FileReader re = null;
BufferedReader buff = null;
try {
File file = new File(filepath);
re = new FileReader(file);
buff = new BufferedReader(re);
String line = "";
String tempString = null;
while ((tempString = buff.readLine()) != null) {
line += tempString;
}
System.out.println(line);
JSONObject jsonObject = JSONObject.parseObject(line);
JSONArray features = jsonObject.getJSONArray("features");
for (int i = 0; i < features.size(); i++) {
J
读取geojson文件
最新推荐文章于 2024-07-30 10:51:07 发布
这篇博客主要介绍了如何读取和处理GeoJSON格式的地理数据文件,包括解析文件内容以及可能的应用场景。
摘要由CSDN通过智能技术生成