javascript - 地理服务器和 OpenLayers
问题描述
<html xmlns="http://www.opengis.net/wfs">
<head>
<title>Openlayers test</title>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v6.0.1/build/ol.js"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v6.0.1/css/ol.css">
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<style>
.map {
height: 500px;
width: 100%;
}
</style>
<script type="text/javascript">
$("#document").ready(function() {
var format = 'image/png';
var bounds = [185100.3262864739, 939575.001675438,
830327.599490219, 2583234.181646719
];
var ThuaDat = new ol.layer.Image({
source: new ol.source.ImageWMS({
ratio: 1,
url: 'http://localhost:8080/geoserver/decuong_doan/wms',
params: {
'FORMAT': format,
'VERSION': '1.1.1',
STYLES: '',
LAYERS: 'decuong_doan:ho_chi_minh_quan',
}
})
});
var projection = new ol.proj.Projection({
code: 'EPSG:3405',
units: 'm',
axisOrientation: 'neu'
});
var map = new ol.Map({
target: 'map',
layers: [
ThuaDat
],
view: new ol.View({
projection: projection
})
});
//map.getView().fitExtent(bounds, map.getSize());
map.getView().fit(bounds, map.getSize());
});
</script>
</head>
<body>
<div id="map" class="map"></div>
</body>
</html>
我正在尝试获取 WebGIS。但是当我编写这段代码时,它并没有在浏览器白色中打开。下面是这段代码。:( 这对我来说真的是一个大问题,所以任何人都可以帮助我,拜托。
这是一个图层预览。所以我想在 WebGIS 中导入这些图层。我得到了这段代码,但它没有运行。
解决方案
推荐阅读
- python - 在python中将逻辑矩阵与包含字符串的向量相乘
- javascript - 使用 Handlebars 创建部分
- python - 如何以编程方式将登录凭据传递到站点
- javascript - 如何在 SQLite(在 Javascript 中)中进行 LIKE 查询,同时将搜索词作为参数传递
- sql - 动态透视未知行数 - Sql View
- vb6 - VB6 表单如何处理来自 C# .NET DLL 的事件
- python-3.x - Selenium - 为什么搜索结果会返回来自 Web serach 的相同元素列表
- networking - GCP 未能创建子网。在分配的 IP 范围内找不到空闲块
- javafx - 尝试在模拟器上运行我的 CodenameOne 项目时出现 NullPointerException
- algorithm - 从给定集合中找到最大的不相交集合并集