[英]Openlayer 3 coordinates
I have a latitude and longitude of some point. 我有一点经纬度。 How to conver its to the OpenLayer 3 map coordinate system?
如何将其转换为OpenLayer 3地图坐标系? My code is:
我的代码是:
...requiries...
var coord = [55.7522200, 37.61556005];
//coord = ol.proj.transform(coord,'EPSG:4326', 'EPSG:3857');
var vectorSource = new ol.source.GeoJSON(
({
object: {
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {
'name': 'EPSG:3857'
}
},
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': coord
}
}
]
}
}));
...
var map = ...
Could you gave me an example for converting the var coords on JavaScript . 你能给我一个关于在JavaScript上转换var coords的例子吗 ? You can see this example of code at link http://openlayers.org/en/v3.0.0/examples/geojson.html
您可以在链接http://openlayers.org/en/v3.0.0/examples/geojson.html上看到此代码示例
如果您有一个坐标[lon, lat]
( [lon, lat]
顺序 ),您可以使用以下方法对其进行转换:
var newCoord = ol.proj.transform([lon, lat], 'EPSG:4326', 'EPSG:3857');
尝试这个
var Coord = ol.proj.transform([lon, lat], 'EPSG:4326', 'EPSG:3857');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.