Openlayers 6.4.3:未捕获类型错误:无法分配给只读属性';0';字符串';bo&x27;
当调整Openlayers 6.4.3:未捕获类型错误:无法分配给只读属性';0';字符串';bo&x27;,openlayers,openlayers-6,Openlayers,Openlayers 6,当调整Map对象的父对象div的大小时,会导致下面的堆栈跟踪。我正在尝试在ExtJS 6.2应用程序中使用 transform.js:117 Uncaught TypeError: Cannot assign to read only property '0' of string 'bo' at Tt (transform.js:117) at e.getPixelFromCoordinateInternal (PluggableMap.js:744)
Map
对象的父对象div
的大小时,会导致下面的堆栈跟踪。我正在尝试在ExtJS 6.2应用程序中使用
transform.js:117 Uncaught TypeError: Cannot assign to read only property '0' of string 'bo'
at Tt (transform.js:117)
at e.getPixelFromCoordinateInternal (PluggableMap.js:744)
at e.getPixelFromCoordinate (PluggableMap.js:730)
at e.updatePixelPosition (Overlay.js:463)
at e.render (Overlay.js:291)
at e.dispatchEvent (Target.js:114)
at e.renderFrame_ (PluggableMap.js:1174)
at e.<anonymous> (PluggableMap.js:179)
Openlayer 4中没有此错误。有什么解决办法吗?我在创建覆盖时出现了这个错误。这是因为我在启动覆盖时使用了position关键字而不是
positioning
首先确保使用了正确的关键字,然后确保传递的是有效的坐标值或未定义的值
create_simple_map: function () {
var mapbox_sat = new ol.layer.Tile({
type: 'base',
visible: true,
source: new ol.source.XYZ({
url: 'https://api.mapbox.com/v4/mapbox.streets-satellite/{z}/{x}/{y}.png?access_token=mytoken'
}),
lyrControlOpt: {
legendGroup: tr('base_layers', 'Base Layers', 'Base maps'),
legendnodeid: 'mapboxid_sat2',
legendTitle: "MapBox Street Satellite",
bbox: null
}
});
var geometery = new ol.geom.Point(ol.proj.fromLonLat([-89.388446, 30.336019]));
var feature = new ol.Feature({
geometry: geometery
})
var source = new ol.source.Vector({});
var style = new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({color: 'rgb(198,38,38)'}),
stroke: new ol.style.Stroke({color: 'rgb(198,38,38)'}),
radius: 5
})
});
feature.setStyle(style);
var overview_point_layer = new ol.layer.Vector({source: source});
overview_point_layer.setZIndex(2000);
var map = new ol.Map({
layers: [
mapbox_sat
],
target: 'overview_map_id',
view: new ol.View({
// projection: 'EPSG:4326',
center: ol.proj.transform(
[-88.793068, 33.456929],
'EPSG:4326', 'EPSG:3857'
),
zoom: 5,
rotation: 0
}),
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: true
})
})
});
source.addFeature(feature);
return [map, feature, overview_point_layer]
}
Ext.define('MyApp.view.main.MyPanel', {
afterrender: function () {
// var overview_cont = Ext.getCmp('overview_map_id');
var maps = create_simple_map();
this.map = maps[0];
var feature = maps[1];
Utils.config.overview_map = this.map;
Utils.config.overview_feature = feature;
Utils.config.overview_point_layer = maps[2];
this.map.setTarget(document.getElementById('overview_map_id'));
Utils.config.overview_map_status = Utils.create_map_status(
this.map);
},
resize: function () {
this.map.updateSize();
}
});