EPSG:4008 图层未显示

发布于 2024-10-07 15:00:38 字数 3732 浏览 9 评论 0原文

我有一张带有 OSM 和 Google Base 图层以及 EPSG:4326 叠加层的地图。现在我还尝试将其他 EPSG 的叠加层添加到我的地图中。 EPSG:2333 的覆盖层显示得很好,没有任何问题。然后我尝试添加 EPSG:4008 图层,但没有显示任何内容。我在 openLayers 论坛上发帖,并被告知要研究 proj4js 项目(顺便说一句,非常感谢!)。我已经尝试过使用它,它看起来很有希望,但它对我不起作用:(

在我的 body 标签中我有脚本

<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

。编辑 我还尝试使用 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"]]

I have a map with OSM and Google Base layers and EPSG:4326 overlays. Now I am also trying to add overlays with other EPSG's to my map. Overlays which had an EPSG:2333 displayed just fine with no problems. Then I tried to add a layer with EPSG:4008 and nothing showed up. I posted on the openLayers forum and was told to look into the proj4js project (many thanks for that btw!). I have tried using it and it seems promising, but it is just not working for me :(

In my body tag I have the scripts

<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?

Then I have these before my map and layer declaration, also in the body tag

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}
               );

and have also tried this layer config...after reading this post 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}
               );

Still nothing shows up :(. Am I doing something wrong? I'm not seeing the error...

Is it even possible to use layers with various projections??? I can't change my map's projection to be 'EPSG:4008' because it will break my other layers, the advice on the docs was to specify the layer's projection, but as my code shows I have tried this with no luck.

I appreciate your time in looking into this matter for me,

elshae

EDIT
I have also tried converting the shapefiles with ogr2ogr:

ogr2ogr -s_srs ./SEDAC/tibet.prj -t_srs EPSG:4326 ./SEDAC/new_tibet.shp ./SEDAC/tibet.shp

And get the following error:

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"]]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

辞别 2024-10-14 15:00:38

我不太确定你想做什么,但 OpenLayers 只能完全重新投影矢量数据。它无法将新的投影应用于图块层(例如 WMS) - 理论上可以轻松地重新投影角,但图块的形状可能会扭曲,而 OpenLayers 没有能力做到这一点。因此,您应该将 WMS 服务器设置为使用您希望在最终应用程序中使用的投影,然后在 OpenLayers 中重新投影任何矢量叠加。

I'm not quite sure what you are trying to do, but OpenLayers can only fully reproject vector data. It cannot apply a new projection to a tile layer (eg. WMS) - in theory corners could be easily reprojected, but the shape of the tiles can be distorted, and OpenLayers does not have the capability to do this. So you should set your WMS server to use the projection you wish to use in the final application, and then reproject any vector overlays in OpenLayers.

◇流星雨 2024-10-14 15:00:38

大家好消息!

我明白了:)

我通过使用以下方法将我的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 等)

快乐映射,

elshae

Good News everyone!

I got it :)

I changed my shapefile to lon lat by using:

ogr2ogr -t_srs WGS84 outfile.shp infile.shp

Although I do wonder if this had any effect in altering my shapefile data in unexpected ways...I see that my preview in Geoserver of the original shapefile seems shifted at an angle that my new WGS84 shapefile does not...

However I'll point out that the angle of the new WGS84 shapefile seems to be more correctly positioned as it overlays my base layer pretty well (some little areas not perfectly, but this might be due to the shapefile itself as it is almost perfect :p)

I want to extend a very warm thank you to Arnd and Wally for their continuous kind and patient help on the OpenLayers forum and for teaching me how to use many great tools that I had never known about. (Proj4js, ogr2ogr, etc)

Happy Mapping,

elshae

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文