0

この行に問題があります 。OpenLayers.ProxyHost="proxy.cgi?url =";

オープンレイヤーコードセットで上記の行を書く以外に何をすべきですか?

私の情報WMSGetFeatureInfoコマンドを使用してWMSイメージの機能情報を取得しようとしています。openlayer2.10、geoserverおよびapache-tomcat-6.0.35を使用しています。localhost:8080を使用してtomcatを実行し、localhost:8080/geoserverを使用してgeoserverを実行できます。

私はOpenLayerを初めて使用し、OpenLayersプロジェクトに関するよくある質問を確認しましたが、それでも答えがわかりません。あなたの答えは私にとって非常に役立ちますか?

貴重なお時間をいただきありがとうございます。

4

1 に答える 1

0

このリンクは役立つ可能性があります:Openlayersプロキシパスの使用法

OpenLayersが実行するタスクの一部(WFS要求を含む)では、リモートサーバーへの要求を行うXMLHTTPRequestの使用に関するJavaScriptの制限のため、プロキシスクリプトを使用する必要があります。マップを設定する前に、その特定の宣言を追加してください。

ここから始めてください:http: //openlayers.org/dev/examples/ 2

コードの例:

    /*
     * Fix for OpenLayers using 900913 for web mercator and AGS using 102113 (it must run before map init)
    OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,altUrl) {
        try {
            var projectionCode=typeof this.options.projection == 'undefined' ? this.map.getProjection() : this.options.projection;
        } catch(err){
            var projectionCode=this.map.getProjection();
        }
        this.params.SRS = projectionCode=="none" ? null : projectionCode;
        return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments);
    }

*/

    OpenLayers.ProxyHost = proxyPath;

    var options = {
        projection: mercator, //EPSG:3785/900913
        displayProjection: geographic, //EPSG:4326
        theme: null,
        maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
        maxResolution: 156543.0339,
        units: 'm',
        controls: [],
        numZoomLevels: MAX_ZOOM_LEVEL,
        allOverlays: true
    };
    OpenLayers.Util.DEFAULT_PRECISION = 18;

    mp = new OpenLayers.Map('map', options);
    addMaps();
    addControls();
    mp.addLayers([googlePhysical, googleSatellite, googleStreets, googleHybrid]);
    //Enabling the preferred layers with a delay of 450 to be able to load the external backgrounds
    setTimeout(setInitialLayersDiv, 450);

    if (!mp.getCenter()) {
        if (document.getElementById('userMapExtent').value != '') {
            var sExtent = document.getElementById('userMapExtent').value.split(',');
            mp.zoomToExtent(new OpenLayers.Bounds(sExtent[0], sExtent[1], sExtent[2], sExtent[3]), true);
        } else {
            mp.zoomToExtent(europeGoogleExtent);
        }
    }
    J('#google_loading').hide('slow');
于 2012-05-25T15:10:11.547 に答える