我有一张带有 OSM 和 Google Base 图层以及 EPSG:4326 叠加层的地图。现在我也在尝试将其他 EPSG 的叠加层添加到我的地图中。具有 EPSG:2333 的叠加层显示得很好,没有问题。然后我尝试使用 EPSG:4008 添加一个图层,但没有任何显示。我在 openLayers 论坛上发帖,并被告知要查看 proj4js 项目(非常感谢顺便说一句!)。我试过使用它,它看起来很有希望,但它对我不起作用:(
在我的身体标签中,我有脚本
<script src="./OpenLayers-2.10/OpenLayers.js"></script>
<script src="./proj4js/lib/proj4js-combined.js"></script> //I did also try proj4js.js, but the docs said use this one?
然后我在我的地图和图层声明之前有这些,也在body标签中
Ext.onReady(function() {
Proj4js.defs["EPSG:4008"] = "+proj=longlat +ellps=clrk66 +no_defs";
Proj4js.defs["SR-ORG:6627"] = "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
...
...
//Map properties
var options = {
controls: [new OpenLayers.Control.Navigation()], //Needed to use GeoExt controls such as the zoomslider
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
units: 'm',
allOverlays: false //Do not display all layers on load
}
var map = new OpenLayers.Map(options);
var borders = new OpenLayers.Layer.WMS(
"Borders", "http://localhost:8080/geoserver/wms", {id: 'borders', layers: 'cite:sedac', transparent: true, projection: new OpenLayers.Projection("EPSG:4008")}, {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true}
);
并且还尝试了这个层配置......在阅读了这篇文章http://getsatisfaction.com/opengeo/topics/reprojecting_in_openlayers
var borders = new OpenLayers.Layer.WMS(
"Borders", "http://localhost:8080/geoserver/wms", {id: 'borders', layers: 'cite:sedac', transparent: true, srsName: 'EPSG:4326'}, {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true}
);
仍然没有出现:(。我做错了什么吗?我没有看到错误...
甚至可以使用具有各种投影的图层吗???我无法将地图的投影更改为“EPSG:4008”,因为它会破坏我的其他图层,文档上的建议是指定图层的投影,但正如我的代码所示,我已经尝试过但没有运气。
感谢您花时间为我调查此事,
艾尔谢
编辑 我也尝试过使用 ogr2ogr 转换 shapefile:
ogr2ogr -s_srs ./SEDAC/tibet.prj -t_srs EPSG:4326 ./SEDAC/new_tibet.shp ./SEDAC/tibet.shp
并得到以下错误:
ERROR 6: No translation for Lambert_Conformal_Conic to PROJ.4 format is known.
Failed to create coordinate transformation between the
following coordinate systems. This may be because they
are not transformable, or because projection services
(PROJ.4 DLL/.so) could not be loaded.
Source:
PROJCS["Lambert_Conformal_Conic",
GEOGCS["Unknown datum based upon the Clarke 1866 ellipsoid",
DATUM["D_Clarke_1866",
SPHEROID["Clarke_1866",6378206.4,294.9786982139109]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]],
PROJECTION["Lambert_Conformal_Conic"],
PARAMETER["standard_parallel_1",25],
PARAMETER["standard_parallel_2",47],
PARAMETER["latitude_of_origin",10],
PARAMETER["central_meridian",110],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["METERS",1]]
Target:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]