|
|
@@ -39,9 +39,15 @@ public class GisController {
|
|
|
List<PipeNetworkBase> list = pipeNetworkService.list();
|
|
|
List<Map<String, Object>> features = new ArrayList<>();
|
|
|
for (PipeNetworkBase pipe : list) {
|
|
|
- if (pipe.getLongitude() == null || pipe.getLatitude() == null) continue;
|
|
|
+ // 检查起终点是否完整
|
|
|
+ if (pipe.getStartLongitude() == null || pipe.getStartLatitude() == null ||
|
|
|
+ pipe.getEndLongitude() == null || pipe.getEndLatitude() == null) {
|
|
|
+ continue; // 起终点不完整则跳过
|
|
|
+ }
|
|
|
+
|
|
|
Map<String, Object> feature = new HashMap<>();
|
|
|
feature.put("type", "Feature");
|
|
|
+
|
|
|
Map<String, Object> props = new HashMap<>();
|
|
|
props.put("networkId", pipe.getNetworkId());
|
|
|
props.put("networkName", pipe.getNetworkName());
|
|
|
@@ -49,13 +55,22 @@ public class GisController {
|
|
|
props.put("networkCode", pipe.getNetworkCode());
|
|
|
props.put("status", pipe.getStatus());
|
|
|
props.put("material", pipe.getMaterial());
|
|
|
+ props.put("startLongitude", pipe.getStartLongitude());
|
|
|
+ props.put("startLatitude", pipe.getStartLatitude());
|
|
|
+ props.put("endLongitude", pipe.getEndLongitude());
|
|
|
+ props.put("endLatitude", pipe.getEndLatitude());
|
|
|
feature.put("properties", props);
|
|
|
+
|
|
|
Map<String, Object> geometry = new HashMap<>();
|
|
|
- geometry.put("type", "Point");
|
|
|
- geometry.put("coordinates", new double[]{pipe.getLongitude().doubleValue(), pipe.getLatitude().doubleValue()});
|
|
|
+ geometry.put("type", "LineString");
|
|
|
+ geometry.put("coordinates", new double[][]{
|
|
|
+ {pipe.getStartLongitude().doubleValue(), pipe.getStartLatitude().doubleValue()},
|
|
|
+ {pipe.getEndLongitude().doubleValue(), pipe.getEndLatitude().doubleValue()}
|
|
|
+ });
|
|
|
feature.put("geometry", geometry);
|
|
|
features.add(feature);
|
|
|
}
|
|
|
+
|
|
|
Map<String, Object> geojson = new HashMap<>();
|
|
|
geojson.put("type", "FeatureCollection");
|
|
|
geojson.put("features", features);
|