[OpenLayers-Users] Query with projection other than 4326

Arnd Wippermann arnd.wippermann at web.de
Thu Jul 17 15:06:06 EDT 2008


Hi,

It is likely a problem with your mapfile configuration. If you use
projection EPSG:32198 for your OpenLayers map than the BBOX values will be
in this projection. OpenLayers is only responsible for creating the
querystring using the projection of the map. 

You can take the value from your input field
"document.getElementById('urlTextInput').value" and request it direct with
your internet explorer.

Arnd
 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Alexandre Dube
Gesendet: Donnerstag, 17. Juli 2008 16:37
An: OpenLayers users mailing list
Betreff: [OpenLayers-Users] Query with projection other than 4326

Hi everybody,

  I'm trying to find a way to get a GetFeatureInfo request working with a
projection other than 4326.  I use a mapfile which has the epsg:32198
projection.

  My query returns no result if I use the proj. 32198.  I have to use
4326 and the result is not always correct, i-e if I click the "a" 
region, I get the "b" region besides the "a" as a result...

  I also tried an other query.  I added a vector layer to my map with the
32198 projection.  Using a bounding box, I query a WMS GetFeature and add
the features to the vector layer ( which are polygons of regions).  The
vector drawn looks like it's not in 32198 proj. but in 4326.  See code
below.

  To be short, my question is how can I use any type of query using an other
projection than 4326 ?

-------  a part of my GetFeature code sample ----------

        var oControl = new OpenLayers.Control();
        OpenLayers.Util.extend(oControl, {
            draw: function () {
                this.box  = new OpenLayers.Handler.Box( oControl,
                    {"done": this.notice},
                    {keyMask: OpenLayers.Handler.MOD_SHIFT});
                this.box.activate();
            },

            notice: function (bounds) {
                OpenLayers.Util.getElement('nodeList').innerHTML =
                "Loading... please wait...";

                //Get LonLat from the 2 pixels of the Bounding Box
                var ll = oMap.getLonLatFromPixel(new OpenLayers.Pixel(
                    bounds.left, bounds.bottom));
                var ur = oMap.getLonLatFromPixel(new OpenLayers.Pixel(
                    bounds.right, bounds.top));

                var sUrl =  olMRC.getFullRequestString({
                           REQUEST: "GetFeature",
                           SERVICE: "WFS",
                           TYPENAME: "NAME_OF_LAYER",
                           VERSION: "1.0.0",
                           MAXFEATURES: "50",
                           BBOX: ll.lon + "," + ll.lat + "," +
                                 ur.lon + "," + ur.lat
                });
                document.getElementById('urlTextInput').value = sUrl;

                OpenLayers.loadURL(sUrl, '', this, drawVectorMRC);
            }
        });

function drawVectorMRC(response) {
    var oFormatGML =  new OpenLayers.Format.GML();
    var oFeatures = oFormatGML.read(response.responseText);
   
    olVectorMRC.destroyFeatures();
    olVectorMRC.addFeatures(oFeatures);
}

--
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list