Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

6 messages Options
Embed this post
Permalink
hauxon

Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

Reply Threaded More More options
Print post
Permalink
I'm doing a map where I draw a feature by using the DrawFeature control and then store it in a DB as WKT. Then I'm calling the feature back by quering the DB and parsing the WKT string to a feature. Works correctly with Firefox and Chrome but the vector renders shifted few meters and rotated in Internet Explorer (both IE7 and IE8). I does not matter if in witch browser I draw the feature, the WKT saves correctly and the same way from IE and Firefox. But when rendering the feature back IE gets it wrong. I have projection suspected but can't find anything wrong, the map has EPSG:3057. I do harvest the bounds from the feature after reading it from WKT and all browsers zoom in and set center correctly.

Here's an image to illustrate the problem:
IE vector problem


Here's how I'm reading and inserting the feature:
	//Create an array of features from WKT
	var wkt = new OpenLayers.Format.WKT();
	arr = new Array(wkt.read(xmlHttp.responseText));
		
	// Create a vector feature from wktArray (only one element for LINESTRING used here)
	var feat = new OpenLayers.Feature.Vector();
	feat = wkt.read(xmlHttp.responseText);//arr[0];
		
	// Add feature to Drawings layer
	getLayerByName("Drawings").addFeatures([feat]);
		
	// Lets zoom down to the feature
	var drawingBounds = new OpenLayers.Bounds();
	drawingBounds = feat.geometry.getBounds();
	map.zoomToExtent(drawingBounds);
	map.setCenter(drawingBounds);

Thanks!
Hrannar Hauksson
hrannar@loftmyndir.is
hauxon

Re: Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

Reply Threaded More More options
Print post
Permalink
I'm using OpenLayers version 2.8
hauxon

Re: Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

Reply Threaded More More options
Print post
Permalink
More info.

This is how the WKT string looks like: (not same feature as in the image above)
LINESTRING(325652 393395,326065 393413)

The same problem occurs with POLYGON.

POINT however is rendered in correct position in IE.

Best, Hrannar
hauxon

Re: Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

Reply Threaded More More options
Print post
Permalink
Even more info: :)

IE debugger tells me this
Line: 1081
Error: Unspecified error.

OpenLayers.js:
1081 this._object.send(vData);
hauxon

Re: Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

Reply Threaded More More options
Print post
Permalink
Here's a link illustrating the problem on our dev server:
http://81.15.38.7/kortasja/kortasja.asp?client=reykjanesbaer&id=40
hauxon

Re: Vector feat. from WKT fucked up in IE but fine in Firefox, and Chrome

Reply Threaded More More options
Print post
Permalink
I've found a solution to my problem.

A fellow programmer copy-pasted a style for the lines from another project.  The offending part was:

var style_blue = OpenLayers.Util.extend({}, layer_style);
style_blue.rotation = 45;

Seems like rotation style only works with Internet Explorer with lines.  I don't know if the lines rotating in IE is a bug or the lines not rotating in other browsers.

Error in line 1081 mentioned in previous post is not related to the problem.

Best, Hrannar