我正在尝试使用angular.toJson()。我收到错误消息“找不到模块:错误:无法在[打字稿路径]中解析“角度””
我尝试过更新角度,安装@ types / angular。无济于事。
import { Map, View } from 'ol';
import TileLayer from 'ol/layer/Tile';
import WMTS from 'ol/tilegrid/WMTS';
import WMTSTileGrid from 'ol/tilegrid/WMTS';
import Group from 'ol/layer/Group.js';
import TileWMS from 'ol/source/TileWMS';
import proj4 from 'proj4/dist/proj4';
import { get as getProjection } from 'ol/proj';
import Projection from 'ol/proj/Projection.js';
import { getTopLeft } from 'ol/extent.js';
import { register } from 'ol/proj/proj4.js'; // ADDED THIS
var myServiceToken = '12345678';
// defining custom projection, because i want to use EPSG:25832 due to the service i'm calling
var projCode = 'EPSG:25832';
proj4.defs(projCode, "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs");
register(proj4); // ADDED THIS
var myProjection = new Projection({
code: 'EPSG:25832',
units: 'm',
extent: [120000, 5661139.2, 1378291.2, 6500000]
});
var projection = getProjection(myProjection);
var projectionExtent = projection.getExtent();
var myTileGrid = new WMTSTileGrid({
origin: getTopLeft(projectionExtent),
extent: [120000, 5661139.2, 1378291.2, 6500000],
resolutions: [1638.4, 819.2, 409.6, 204.8, 102.4, 51.2, 25.6, 12.8, 6.4, 3.2, 1.6, 0.8, 0.4, 0.2],
matrixIds: ['L00', 'L01', 'L02', 'L03', 'L04', 'L05', 'L06', 'L07', 'L08', 'L09', 'L10', 'L11', 'L12', 'L13'],
});
const map = new Map({
target: 'map',
layers: [
new Group({
'title': 'Base maps',
layers: [
new TileLayer({
opacity: 1.0,
title: 'Base',
type: 'base',
visible: true, // by default this layer is visible
source: new WMTS({
url: "https://services.someService.com/some_map?token=" + myServiceToken,
layer: "some_map",
matrixSet: "View1",
format: "image/jpeg",
projection: getProjection('EPSG:25832'), // ADDED THIS
tileGrid: myTileGrid,
style: 'default',
size: [256, 256]
})
})
]
})
],
view: view
});```
我应该在控制台中看到一个JSON对象,但是我什至无法构建代码,请帮忙!