通过在本地 DD、DMS、DDM 之间轻松交换,格式化 GeoJSON 与 OpenLayers 协调?
Format GeoJSON coordinates with OpenLayers by easily swapping between DD, DMS, DDM natively?
从 OpenLayers 写入 GeoJSON 时,默认坐标格式是什么?从 ExtentInteraction 编写 GeoJSON 时,我得到如下格式的输出:
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-13614109.32469666 ,-1789063.2448918968],[-13614109.32469666,3379341.6847958053],[-6736155.0721122585,3379341.6847958053],[-6736155.0721122585,-1789063.2448918968],[-13614109.32469666,-1789063.2448918968]]]},"properties":null}]}
抱歉,我是个新手。另外,在 Openlayers 网站上没有看到它 API 文档。
另外,有没有办法编写GeoJSON,以便以指定格式返回坐标。 IE。 DD、DMS 和 DDM
这就是我现在编写 GeoJSON 的方式:
const extentCopy = extent.getExtent();
new GeoJSON().writeFeatures([new Feature(fromExtent(extentCopy))]);
多谢提前指教
您的结果以视图投影单位为单位。对于学位使用
new GeoJSON().writeFeatures(
[new Feature(fromExtent(extentCopy))],
{dataProjection: 'EPSG:4326', featureProjection: map.getView().getProjection()}
);
从 OpenLayers 写入 GeoJSON 时,默认坐标格式是什么?从 ExtentInteraction 编写 GeoJSON 时,我得到如下格式的输出:
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-13614109.32469666 ,-1789063.2448918968],[-13614109.32469666,3379341.6847958053],[-6736155.0721122585,3379341.6847958053],[-6736155.0721122585,-1789063.2448918968],[-13614109.32469666,-1789063.2448918968]]]},"properties":null}]}
抱歉,我是个新手。另外,在 Openlayers 网站上没有看到它 API 文档。
另外,有没有办法编写GeoJSON,以便以指定格式返回坐标。 IE。 DD、DMS 和 DDM
这就是我现在编写 GeoJSON 的方式:
const extentCopy = extent.getExtent();
new GeoJSON().writeFeatures([new Feature(fromExtent(extentCopy))]);
多谢提前指教
您的结果以视图投影单位为单位。对于学位使用
new GeoJSON().writeFeatures(
[new Feature(fromExtent(extentCopy))],
{dataProjection: 'EPSG:4326', featureProjection: map.getView().getProjection()}
);