にreprojetするにGeoJSONのCRSを使用しOpenlayerことができます:は4私は、サーバーからCRSの定義とにGeoJSONファイル読んでい場
{"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32720" } },
"features": [ many features,.....
その後
地図上にロードしますが、それは別の大陸に表示されますグリニッジ子午線に近い。
私はドキュメントを読んで、多くの場所にfeatureProjectionオプション がありますが、私はソースかターゲットかを知っていません。
私は試してみてください。
var vectorLayerUTMPoints = new ol.layer.Vector({
source: new ol.source.Vector({
url: '/static/points.geojson',
format: new ol.format.GeoJSON({featureProjection: 'EPSG:32720'}) //
})
});
また:
var vectorLayerUTMPoints = new ol.layer.Vector({
source: new ol.source.Vector({
url: '/static/points.geojson',
projection: 'EPSG:32720',
format: new ol.format.GeoJSON()
}) });
マップを参照するためにOSM層をロードし、良い仕事:
var map = new ol.Map({
layers: [
new ol.layer.Tile({source: new ol.source.OSM()}),
vectorLayerUTMPoints
],
target: 'map',
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: false
})
}),
view: new ol.View({
projection: 'EPSG:3857',
center: [0, 0],
zoom: 2
})
});
質問は、OpenLayer 4を読むことができますgeojsonファイルのcrs定義を編集し、 を彼の飛行のビューのcrsに変換するか、またはどうすればそれを解決できますか?