| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.opengis.filter.Filter; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.StringWriter; |
| | | import java.util.*; |
| | | |
| | | public class ShapeFileUtil { |
| | | /* |
| | | * @param zipFile: 压缩包文件地址 |
| | | * @return FeatureCollection |
| | | * @author pangshicheng |
| | | * @description 解析shp压缩包,并返回解析出的 FeatureCollection |
| | | * @date 2023/7/18 16:02 |
| | | */ |
| | | |
| | | //将文件解压 |
| | | public static FeatureCollection getFeatureCollectionByShpFile(File zipFile) throws IOException { |
| | | try { |
| | | String tempDir = FileUtil.getTmpDirPath(); |
| | |
| | | /** |
| | | * @param zipFile: |
| | | * @return JSONObject |
| | | * @author pangshicheng |
| | | * @description 通过shp压缩文件,将其转换为GeoJson格式 |
| | | * @date 2023/7/18 16:04 |
| | | */ |
| | | //将解压后的文件转换成GeoJson格式 |
| | | public static List<String> shpToGeoJson(File zipFile) throws IOException { |
| | | FeatureJSON fjson = new FeatureJSON(); |
| | | JSONObject geoJsonObject = new JSONObject(); |