当前位置:网站首页>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

图层为
启动服务 运行成功
作者声明
如有问题,欢迎指正!
边栏推荐
- localhost with 127.0.0.1
- 71-page comprehensive overall solution for global tourism 2021 ppt
- Recommended open source tools: MegPeak, a high-performance computing tool
- The use of ccs software (app software that makes money reliably)
- 一文读懂网络效应对Web3的重要意义
- 5. DOM
- DDS Arbitrary Waveform Output Based on FPGA
- What is the relationship between the construction of smart cities and 5G technology in the new era
- Normal and escaped strings for postgresql
- MySql error: SqlError(Unable to execute query", "Can't create/write to file OS errno 2 - No such file...
猜你喜欢

Remember an experience of interviewing an outsourcing company, should you go?

四大首搭加持,美学、安全、操控、效率优势明显,比亚迪海豹售价20.98万元起售!

MongoDB启动报错 Process: 29784 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)

Still saying software testing doesn't have a midlife crisis?9 years of test engineers were eliminated

如何在 TiDB Cloud 上使用 Databricks 进行数据分析 | TiDB Cloud 使用指南

瑞吉外卖项目实战Day02

Recommended open source tools: MegPeak, a high-performance computing tool

Flink本地UI运行

Metaverse Post Office AI space-themed series of digital collections will be launched at 10:00 on July 30th "Yuanyou Digital Collection"

关于mariadb/mysql的user表:密码正确但登录失败,可能与mysql的空用户有关
随机推荐
Huawei issues another summoning order for "Genius Boys"!He, who had given up an annual salary of 3.6 million, also made his debut
postgresql的普通字符串和转义字符串
【回归预测-CNN预测】基于卷积神经网络CNN实现数据回归预测附matlab代码
MaxWell scraped data
Recommended open source tools: MegPeak, a high-performance computing tool
Allure Advanced - Dynamically Generate Report Content
【回归预测-lssvm分类】基于最小二乘支持向量机lssvm实现数据分类代码
这个编辑器居然号称快如闪电!
LeetCode_数位枚举_困难_233.数字 1 的个数
Flink实时数仓完结
71页全域旅游综合整体解决方案2021 ppt
JVM性能调优
ToDesk版本更新,引入RTC传输技术,是否早以替代向日葵远程控制?
存储器映射、位带操作
机房布线的至高境界,美到窒息
The main content of terrain analysis (the special effect level of the wandering earth)
关于String的一些思考
MySql error: SqlError(Unable to execute query", "Can't create/write to file OS errno 2 - No such file...
What is Ts?
Fink异步IO的实战(关联维表)