当前位置:网站首页>GeoServer + openlayers
GeoServer + openlayers
2022-07-30 14:40:00 【努力学习,努力爱你!】
GeoServer 安装
前提有java环境
安装地址
https://geoserver.org/release/stable/
此处以二进制下载为例
下载后解压
D:\Program Files (x86)\geoserver-2.21.0-bin\bin
http://localhost:8080/geoserver 进入服务
使用默认用户名admin和密码geoserver登陆
图源准备
百度网盘下载 地图软件全能地图
链接:https://pan.baidu.com/s/1UZGx86R1b4VBDO9HOD-gFw
提取码:0125
下载后解压
除选择安装位置外 一路next
全能地图下载器使用
打开后 先试用一个月
可以选择地图来源 我选择的是地图 -》谷歌地图-》混合
地图级别 我选择的是12 可以自行选择
下载先用矩形工具或者其他工具选出来一个区域
在点击任务列表可自定义名称
地图下载 设置 定义格式 点击地图下载 开始 开始下载
格式等默认即可
选择是 拼接
这三个选择然后点击拼接
将图源放到geoServer服务器上

创作工作空间
选择存储仓库 点击geoTIFF 栅格数据上传
工作空间选择刚刚创建了
数据源名称 自己填写
下面地址 要选择刚刚的图源地址的 tif文件
点击发布
然后保存即可
图层预览-》选择刚刚创建的图层 点击openlayers进行预览
部署成功 ,右下角显示经纬度
openlayers 使用
由于我们部署使用的是wms方式所以选择wms样例加载图源
我选择的是https://openlayers.org/en/latest/examples/epsg-4326.html
vue工程中需要运行 npm install ol 导入openlayers
将样例中 main.js放到mounted函数中
将页面抽取出来放到上面
此样例的写法抽取如下
<template>
<div id="map" class="map"></div>
</template>
<script> import Map from "ol/Map"; import TileLayer from "ol/layer/Tile"; import TileWMS from "ol/source/TileWMS"; import View from "ol/View"; import {
ScaleLine, defaults as defaultControls } from "ol/control"; export default {
mounted() {
const layers = [ new TileLayer({
source: new TileWMS({
url: "http://localhost:8080/geoserver/ouc/wms", //地址要换成自己的可看下方 params: {
LAYERS: "ouc:谷歌混合07292025", //图层也是 可看下方 TILED: true, }, }), }), ]; new Map({
controls: defaultControls().extend([ new ScaleLine({
units: "degrees", }), ]), layers: layers, target: "map", view: new View({
projection: "EPSG:4326", center: [120.44, 36.13], zoom: 12, }), }); }, }; </script>
<style> .map {
height: 400px; width: 100%; } </style>
在图层预览中 F12 network ctrl+R调出请求

url 为请求前缀到wms

图层为
启动服务 运行成功
作者声明
如有问题,欢迎指正!
边栏推荐
- Container sorting case
- 5G-based Warehousing Informatization Solution 2022
- Our company has used gateway services for 6 years, dynamic routing, authentication, current limiting, etc., a stable batch!
- JUC common thread pool source learning 02 ( ThreadPoolExecutor thread pool )
- Still saying software testing doesn't have a midlife crisis?9 years of test engineers were eliminated
- 嵌入式开发:嵌入式基础知识——正确启动固件项目的 10 条建议
- The evolution of content products has three axes: traffic, technology, and product form
- MySQL客户端工具的使用与MySQL SQL语句
- 71页全域旅游综合整体解决方案2021 ppt
- 智能合约安全——私有数据访问
猜你喜欢

智能合约安全——私有数据访问

学习 MySQL 需要知道的 28 个小技巧

Desktop Software Development Framework Awards

Flink real-time data warehouse completed

The highest level of wiring in the computer room, the beauty is suffocating

5G-based Warehousing Informatization Solution 2022

JVM performance tuning

Go to Tencent for an interview and let people turn left directly: I don't know idempotency!

5. DOM

Alluxio为Presto赋能跨云的自助服务能力
随机推荐
Hello, World
如何在 TiDB Cloud 上使用 Databricks 进行数据分析 | TiDB Cloud 使用指南
Before quitting, make yourself a roll king
容器排序案例
In-depth analysis of Kubernetes application management
自动化办公|办公软件和亿图脑图MindMaster快捷键
Still saying software testing doesn't have a midlife crisis?9 years of test engineers were eliminated
5. DOM
ESP32 Repeated Reboot Issue Arduino Shield Power Outage Detector
Get the Google Advertising ID as a unique identifier
Metaverse Post Office AI space-themed series of digital collections will be launched at 10:00 on July 30th "Yuanyou Digital Collection"
Kubernetes应用管理深度剖析
CS内网横向移动 模拟渗透实操 超详细
有关收集箱的改进建议
1700. 无法吃午餐的学生数量
Fink异步IO的实战(关联维表)
智能合约安全——私有数据访问
剑指 Offer II 037. 小行星碰撞
ROS 导航
Web消息推送之SSE