[OpenLayers-Users] Query with projection other than 4326
Alexandre Dube
adube at mapgears.com
Thu Jul 17 10:36:51 EDT 2008
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
More information about the Users
mailing list