EPSG:4008图层不显示

时间:2010-12-16 16:08:45

标签: openlayers proj4js srid epsg

我有一张包含OSM和Google Base图层以及EPSG:4326叠加层的地图。现在我也尝试在我的地图上添加其他EPSG的叠加层。 EPSG:2333的叠加显示正常,没有任何问题。然后我尝试添加一个EPSG图层:4008并没有显示任何内容。我发布在openLayers论坛上,并被告知要调查proj4js项目(非常感谢你的btw!)。我尝试过使用它似乎很有希望,但它对我不起作用:(

在我的身体标签中,我有脚本

<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',因为它会破坏我的其他图层,对文档的建议是指定图层的投影,但正如我的代码显示我尝试了这一点没有运气。

感谢您抽出时间为我调查此事,

elshae

修改 我也尝试用ogr2​​ogr转换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"]]

2 个答案:

答案 0 :(得分:0)

我不太确定你要做什么,但OpenLayers只能完全重新投影矢量数据。它无法将新投影应用于切片图层(例如WMS) - 理论上,角落可能很容易重新投影,但是切片的形状可能会失真,而OpenLayers无法执行此操作。因此,您应该将WMS服务器设置为使用您希望在最终应用程序中使用的投影,然后在OpenLayers中重新投影任何矢量叠加层。

答案 1 :(得分:0)

大家好消息!

我明白了:)

我使用:

将shapefile更改为lon lat
ogr2ogr -t_srs WGS84 outfile.shp infile.shp

虽然我确实想知道这是否会以意想不到的方式改变我的shapefile数据...我看到我在原始shapefile的Geoserver中的预览似乎移动了一个角度,我的新WGS84 shapefile没有... < / p>

但是我会指出新WGS84 shapefile的角度似乎更正确定位,因为它很好地覆盖了我的基础层(一些小区域不完美,但这可能是由于shapefile本身,因为它是几乎完美:p)

我非常感谢Arnd和Wally在OpenLayers论坛上给予他们持续的耐心帮助,并教我如何使用我从未了解过的许多优秀工具。 (Proj4js,ogr2ogr等)

快乐映射,

elshae