本文介绍了传单:如何显示带有AutoCAD数据的Geojson文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将geojson文件(从 AutoCAD 文件转换为geojson)显示为第二层(第一层映射 OSM ).
I am tried to display geojson file (converted from AutoCAD file to geojson) as the Second layer (first layer maps OSM).
但是geojson内容占据了整个地图,而不是在特定位置.
But geojson content occupies entire maps, not in a specific location.
如何更改geojson文件中的坐标或如何减小geojson(第二层)的高度和宽度?请在下面的示例geojson文件中找到...
How can we change coordinates in geojson file or how to reduce the height and width of geojson(second layer)? Please find below the Sample geojson file...
{
"type": "FeatureCollection",
"name": "entities",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features": [
{
"type": "Feature",
"properties": {
"Layer": "entities",
"SubClasses": "AcDbEntity:AcDbPolyline",
"EntityHandle": "1FFF0038"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
0,
0
],
[
0,
319.9694
],
[
361.2444,
319.9694
],
[
361.2444,
0
],
[
0,
0
]
]
}
},
{
"type": "Feature",
"properties": {
"Layer": "entities",
"SubClasses": "AcDbEntity:AcDbPolyline",
"EntityHandle": "1FFF011D"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
0,
252.0448
],
[
0,
319.9694
],
[
361.2444,
319.9278
],
[
361.2444,
142.5544
],
[
0,
142.5544
],
[
0,
197.4439
],
[
9.1842,
197.4439
],
[
9.1842,
151.7295
],
[
352.0603,
151.7295
],
[
352.0603,
310.7537
],
[
9.1842,
310.7932
],
[
9.1842,
252.0448
],
[
0,
252.0448
]
]
}
}
]
}
推荐答案
最后,我通过取消投影CRS EPSG3857获得了解决方案,然后同一个geojson文件在Leaflet中正常工作.谢谢..
Finally i got solution by unprojecting CRS EPSG3857 then the same geojson file working fine in leaflet.Thanks..
通过添加,
L.CRS.EPSG3857.unproject(point) // where point is coords.
这篇关于传单:如何显示带有AutoCAD数据的Geojson文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!