如何解决使用 proj4leaflet 时出现错误“Invalid LatLng object: (NaN, 86.06925048939979)”
我在使用 proj4leaflet 时遇到错误“无效的 LatLng 对象:(NaN,86.06925048939979)”
我正在使用 react 传单制作交互式地图。对于 gall-peter 地图投影,我使用了 proj4leaflet,同时使用这个抛出错误“无效的 LatLng 对象:(NaN,86.06925048939979)”正常投影很好。详细的错误抛出是:
*> 未捕获的错误:无效的 LatLng 对象:(NaN,86.06925048939979)
at new LatLng (LatLng.js:32)
at NewClass.unproject (proj4leaflet.js:46)
at NewClass.pointToLatLng (CRS.js:41)
at NewClass.unproject (Map.js:1000)
at NewClass.layerPointToLatLng (Map.js:1008)
at NewClass._fireDOMEvent (Map.js:1436)
at NewClass._handleDOMEvent (Map.js:1397)
at HTMLDivElement.handler (DomEvent.js:92)*
crs = new L.Proj.CRS(
'EPSG:25832','+proj=cea +lon_0=0.0 +x_0=0.0 +y_0=0.0 +lat_ts=45.0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
// '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0 +units=m +no_defs',{
resolutions: [
64000,32700,16392,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1,0.5
]
});
render() {
return (
<div className="map_wraper">
{
this.context.sharedValues.loader ? <Loader /> : <MapContainer
style={this.containerStyle}
zoom={this.zoomLevel}
center={[10,0]}
crs={this.crs}
>
<MapConsumer>
{(map) => {
this.map = map
map.on('zoomend',this.zoomHandler)
return null
}}
</MapConsumer>
<GeoJSON style={this.contryStyle} data={features} onEachFeature={this.onEachCountry} />
</MapContainer>
}
</div>
)
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。