长江流域9省2市可视化(不展示业务信息水质及真实断面)

news2025/2/27 8:22:27

一、处理9省+2市地理信息为geojson集成到项目

 shp转geojson关键Java代码

/**
 * shp转换为Geojson
 * @param shpPath
 * @return
 */
public static Map shape2Geojson(String shpPath,String filePath){
    Map map = new HashMap();

    FeatureJSON fjson = new FeatureJSON();

    try{
        StringBuffer sb = new StringBuffer();
        sb.append("{\"type\": \"FeatureCollection\",\"features\": ");

        File file = new File(shpPath);
        ShapefileDataStore shpDataStore = null;

        shpDataStore = new ShapefileDataStore(file.toURL());
        //设置编码
        Charset charset = Charset.forName("utf-8");
        shpDataStore.setCharset(charset);
        String typeName = shpDataStore.getTypeNames()[0];
        SimpleFeatureSource featureSource = null;
        featureSource =  shpDataStore.getFeatureSource (typeName);
        SimpleFeatureCollection result = featureSource.getFeatures();
        SimpleFeatureIterator itertor = result.features();
        JSONArray array = new JSONArray();
        while (itertor.hasNext())
        {
            SimpleFeature feature = itertor.next();
            StringWriter writer = new StringWriter();
            fjson.writeFeature(feature, writer);
            JSONObject json = new JSONObject(writer.toString());
            array.put(json);
        }
        itertor.close();
        sb.append(array.toString());
        sb.append("}");

        //写入文件
        try {
            File geofile = new File(filePath);
            PrintStream ps = new PrintStream(new FileOutputStream(geofile));
            ps.println( sb.toString());// 往文件里写入字符串
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


        map.put("status", "success");
        map.put("message", sb.toString());
    }
    catch(Exception e){
        map.put("status", "failure");
        map.put("message", e.getMessage());
        e.printStackTrace();

    }
    return map;
}

二、配置可视化展示图层信息

前端架构设计实现可参照:iClientOL实现前端gis开发架构_兴诚的博客-CSDN博客

import { Layersymbols } from '../SymbolsInfo/mapSymbols'
import GeoJSON from 'ol/format/GeoJSON'
import {getLyaerRenderSymbol} from '../MapCommon'
import {LayersRenderSet} from '../RendersInfo/LayersRenderSet'

export let layersInfo = {
  wyl: {
    layerCode:'wyl',
    sourceType:'ArcgisTile',
    title:'午夜蓝',
    url:'http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer',
    visible:false
  },
  XZQHRegion: {
    layerCode:'XZQHRegion',
    isRLayerPanel: true,
    sourceType: 'Vector',
    title: '行政区划',
    url: '/static/geojson/changjiangRegion/510000/bound.json',
    dataPath:'',
    geoType: 'geojson',
    wrapX: false,
    opacity: 1,
    location: {longitude: 109.46198629061443, latitude: 29.504518455495273, level: 5.64688833592623},
    visible: true
  },
  shanghaiRegion: {
    layerCode:'shanghaiRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/310000/bound.json',
    title:'上海市',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  jiangsuRegion: {
    layerCode:'jiangsuRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/320000/bound.json',
    title:'江苏省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  zhejiangRegion: {
    layerCode:'zhejiangRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/330000/bound.json',
    title:'浙江省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  anhuiRegion: {
    layerCode:'anhuiRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/340000/bound.json',
    title:'安徽省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  jiangxiRegion: {
    layerCode:'jiangxiRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/360000/bound.json',
    title:'江西省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  hubeiRegion: {
    layerCode:'hubeiRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/420000/bound.json',
    title:'湖北省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  hunanRegion: {
    layerCode:'hunanRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/430000/bound.json',
    title:'湖南省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  chongqingRegion: {
    layerCode:'chongqingRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/500000/bound.json',
    title:'重庆市',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  sichuanRegion: {
    layerCode:'sichuanRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/510000/bound.json',
    title:'四川省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  yunnanRegion: {
    layerCode:'yunnanRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/530000/bound.json',
    title:'云南省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  guizhouRegion: {
    layerCode:'guizhouRegion',
    isRLayerPanel: true,
    sourceType:'GeoVector',
    url:'/static/geojson/changjiangRegion/520000/bound.json',
    title:'贵州省',
    style:Layersymbols.areaRegionSymbol,
    format: new GeoJSON(),
    wrapX: false,
    opacity: 1,
    location: {longitude: 115.783878, latitude: 34.308761, level: 8},
    visible:true
  },
  changjiangLine: {
    layerCode: 'changjiangLine',
    isRLayerPanel: true,
    sourceType: 'Vector',
    title: '长江',
    url: '/static/geojson/changjiangRegion/riverL1.json',
    dataPath:'',
    // labelField: 'NAME',
    geoType: 'geojson',
    maxZoom: Infinity,
    minZoom: -Infinity,
    wrapX: false,
    opacity: 1,
    location: {longitude: 109.46198629061443, latitude: 29.504518455495273, level: 5.64688833592623},
    visible: true
  },
  geoJsonFe1: {
    layerCode: 'geoJsonFe1',
    isRLayerPanel: true,
    sourceType: 'Vector',
    title: '断面',
    url: '/static/geojson/changjiangRegion/duanmian.json',
    dataPath:'',
    floatLabelInfo: {floatLabelField: 'val', offsetX: 8, offsetY: -16},
    geoType: 'geojson',
    maxZoom: Infinity,
    minZoom: -Infinity,
    wrapX: false,
    opacity: 1,
    location: {longitude: 109.46198629061443, latitude: 29.504518455495273, level: 5.64688833592623},
    visible: true
  },
  CRegion: {
    layerCode: 'CRegion',
    sourceType: 'Vector',
    title: '绘制区域',
    wrapX: false,
    isModify: true,
    opacity: 1,
    visible: false
  },
  LS: {
    layerCode:'LS',
    sourceType:'Vector',
    title:'临时',
    wrapX:false,
    opacity: 1,
    visible:true
  }
}

三、行政区划刷新关键前端代码

refreshXZQH(regionCode){
  commonRefreshVectorGeojsonLayer('/static/geojson/changjiangRegion/'+regionCode+'/XZQH.json',layersInfo,'XZQHRegion',this.smap)
}

四、可视化效果

如果对恁有帮助,请点赞打赏支持! 

技术合作交流qq:2401315930

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/426935.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

阶段二33_面向对象高级_IO[转换流,对象流]

知识点: 1.转换流:InputStreamReader,OutputStreamWriter2.对象流:ObjectInputStream,ObjectOutputStream一.转换流 1.转换流原理图 2.转换流概述 转换流就是来进行字节流和字符流之间转换的 InputStreamReader是从…

p75 应急响应-数据库漏洞口令检索应急取证箱

数据来源 必须知识点: 第三方应用由于是选择性安装,如何做好信息收集和漏洞探针也是获取攻击者思路的重要操作, 除去本身漏洞外,提前预知或口令相关攻击也要进行筛选。排除三方应用攻击行为,自查漏洞分析攻击者思路&a…

表白墙(服务器版)

文章目录一、准备工作二、前后端交互后端前端三、数据库版本一、准备工作 我们之前实现过这样一个表白墙,具体前端代码参考 表白墙 这篇文章 但是我们之前写的这个表白墙有一些问题: 1.如果我们刷新页面/重新开启,之前的数据就不见了 2.我们…

python pyc文件

参考自 What are pyc files in Python 和Python什么情况下会生成pyc文件? - 知乎 加上了我自己的理解 官方文档有这么解释 A program doesnt run any faster when it is read from a ‘.pyc’ or ‘.pyo’ file than when it is read from a ‘.py’ file; the o…

C生万物 | 一探指针函数与函数指针的奥秘

文章目录一、指针函数1、定义2、示例二、函数指针1、概念理清2、如何调用函数指针&#xff1f;3、两道“有趣”的代码题O(∩_∩)O< 第一题 >< 第二题 >4、函数指针数组概念明细具体应用&#xff1a;转移表✔5、指向函数指针数组的指针三、实战训练 —— 回调函数1、…

Pix4D软件简易使用方法

一、实验目的 学习无人机处理软件 Pix4D 的各项基本功能模块&#xff0c;掌握处理无人机影像的一般处理流程及质量评价。学习新建项目&#xff0c;对图像进行初始化操作以便后处理。学会制作正射影像图&#xff0c;生成质量报告&#xff0c;并对其进行分析。 二、实验内容 &…

抽象轻松MySqL

第一步安装下载MySQL 手把手教你下载安装 第一步打开官方网站 这里提供两种——第一种懒人版&#xff1a;MySQL点击蓝色字会有链接 第二种手动版本&#xff1a;百度搜索Mysql&#xff08;注意不要点.cn的因为有点翻译问题&#xff09; 点开后的图如下 接下来开始装备下载 点…

Disentangled Graph Collaborative Filtering

代码地址&#xff1a;https://github.com/ xiangwang1223/disentangled_graph_collaborative_filtering Background&#xff1a; 现有模型在很大程度上以统一的方式对用户-物品关系进行建模(将模型看做黑盒&#xff0c;历史交互作为输入&#xff0c;Embedding作为输出。)&…

【C++进阶之路】初始C++

文章目录一.C的发展历史时代背景产生原因发型版本二.C的应用场景三.C 的学习成本C的难度C的学习阶段21天精通C的梗一.C的发展历史 时代背景 20世纪60年代——软件危机。部分原因:C语言等计算机语言是面向过程语言&#xff0c;在编写大型程序需要高度抽象与建模&#xff0c;此…

HTML中表格标签<table><tr><tb><th>中单元格的合并问题

前情知晓 层级关系如下&#xff1a; <table><tr><td> </td><th> </th></tr></table> <table>...</table> 用于定义一个表格开始和结束 <tr>...</tr> 定义一行标签&#xff0c;一组行标签内可以建立…

【前端】从零开始读懂Web3

序言 用心生活&#xff0c;用力向上&#xff0c;微笑前行&#xff0c;就是对生活最好的回馈。 本专栏说明&#xff1a; 主要是记录在分享知识的同时&#xff0c;不定时给大家送书的活动。 参与方式&#xff1a; 赠书数量&#xff1a;本次送书 3 本&#xff0c;评论区抽3位小伙伴…

Python进阶特性(类型标注)

1.4 Python进阶特性(类型标注) 1.4.1 类型标注介绍 Python属于动态类型语言&#xff0c;只有在运行代码的时候才能够知道变量类型&#xff0c;那么这样容易产生传入参数类型不一致的问题&#xff0c;导致出现意想不到的bug。这也是动态类型语言天生的一个问题。 所以在Python…

【Spring】— Spring中Bean的装配方式

Spring中Bean的装配方式Bean的装配方式1.基于XML的装配2.基于Annotation的装配3.自动装配Bean的装配方式 Bean的装配可以理解为依赖关系注入&#xff0c;Bean的装配方式即Bean依赖注入的方式。Spring容器支持多种形式的Bean装配方式&#xff0c;如基于XML的装配、基于Annotatio…

电力系统中针对状态估计的虚假数据注入攻击建模与对策(Matlab代码实现)

&#x1f352;&#x1f352;&#x1f352;欢迎关注&#x1f308;&#x1f308;&#x1f308; &#x1f4dd;个人主页&#xff1a;我爱Matlab &#x1f44d;点赞➕评论➕收藏 养成习惯&#xff08;一键三连&#xff09;&#x1f33b;&#x1f33b;&#x1f33b; &#x1f34c;希…

免费部署属于自己的chatGPT网站,欢迎大家试玩

最近我发现了一个非常nice的部署网站的工具&#xff0c; railway&#xff0c;这个网站是国外的&#xff0c;所以部署出来的项目域名是国外的&#xff0c;并不需要担心封号&#xff0c;也不需要进行域名注册&#xff0c;部署成功之后会自动生成域名&#xff0c;在国内就能够正常…

[NSSRound#11] 密码学个人赛

这个比赛没有参加,跟别人要了些数据跑一下,其实交互这东西基本上一样,跑通就行. ez_enc 这题有点骗人,给了一堆AB串,一开始以为是培根密码,结果出来很乱.再看长度:192 应该就是01替换 a ABAABBBAABABAABBABABAABBABAAAABBABABABAAABAAABBAABBBBABBABBABBABABABAABBAABBABAA…

“心机boy”马斯克:明面上呼吁暂停先进AI研发,背地里悄悄买1万块GPU推进大模型项目

来源: AI前线 微信号&#xff1a;ai-front 整理 | 冬梅、核子可乐 为了研发自家 AIGC&#xff0c; 马斯克狂买 GPU 并四处挖人 当地时间 4 月 11 日&#xff0c;据多家外媒报道&#xff0c;尽管高调建议在整个行业范围内停止 AI 训练&#xff0c;但伊隆马斯克本人倒是在 T…

VMware:安装centos7

环境&#xff1a; 准备好VMware软件 准备好centos镜像 如有需要 寻找镜像&&真机安装&&真机安装时候找不到硬盘 可以查看 &#xff1a; linux&#xff1a;真机安装centos linux&#xff08;突发事件&#xff1a;解决卡在安装界面&#xff09;{寻找镜像--u…

springboot+vue简历系统(源码+文档)

风定落花生&#xff0c;歌声逐流水&#xff0c;大家好我是风歌&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款基于springboot的简历系统简历系统。项目源码请联系风歌&#xff0c;文末附上联系信息 。 目前有各类成品java毕设&#xff0c;需要请看文末联系方式 …

Excel中的表格批量生成word表格

场景&#xff1a;测试用例excel转word 我们在项目中&#xff0c;默认情况下是用我们的excel用例模版输出测试用例。但是有的项目中&#xff0c;会要求在word版本的测试计划或者测试报告中&#xff0c;写明测试用例。而我们的测试用例&#xff0c;有的项目有上千条&#xff0c;…