我有一个地图与OSM和谷歌基础层和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}
);也尝试过这个图层config...after阅读这个帖子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”,因为它会破坏我的其他层,所以docs上的建议是指定图层的投影,但正如我的代码所示,我没有成功地尝试过这一点。
我很感激你能为我研究这件事,
埃尔谢
编辑--我也尝试过用ogr2ogr转换表单文件:
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"]]发布于 2010-12-17 02:05:52
我不太清楚您想要做什么,但是OpenLayers只能完全重新设计向量数据。它不能将新的投影应用于瓷砖层(例如。在理论上,角可以很容易地重新投影,但瓷砖的形状可能会被扭曲,而且OpenLayers没有能力这样做。因此,您应该将WMS服务器设置为使用您希望在最终应用程序中使用的投影,然后在OpenLayers中重新投影任何向量覆盖。
发布于 2011-01-04 17:47:49
好消息大家!
我拿到了:)
我将我的shapefile改为lon lat,方法是:
ogr2ogr -t_srs WGS84 outfile.shp infile.shp虽然我想知道这是否对以意外的方式改变我的shapefile数据有任何影响.我看到我在原始shapefile的Geoserver中的预览似乎从一个角度移动,而我的新的WGS84 shapefile没有.
不过,我要指出的是,新的WGS84 shapefile的角度似乎更正确,因为它很好地覆盖了基本层(有些小区域并不完美,但这可能是由于shapefile本身的原因,因为它几乎是完美的:p)
我想向Arnd和Wally致以非常热烈的感谢,感谢他们在OpenLayers论坛上的持续的友好和耐心的帮助,并教我如何使用我从未听说过的许多伟大的工具。(Proj4js、ogr2ogr等)
快乐地图,
埃尔谢
https://stackoverflow.com/questions/4462795
复制相似问题