[OpenLayers-Users] Writing KML - Reprojection problem

jllodra jlg.hrtc at gmail.com
Wed Jul 13 04:50:31 EDT 2011


Hi, I am trying to export some vector features to a kml file.

The problem is that I am using a Google Map as base layer, which is
EPSG:900913.
But KML is a format that uses lat/lon, instead of meters in x/y.

So, when creating the Format.KML object, I specify projections:

                var out = new OpenLayers.Format.KML({
					internalProjection: map.projection, // which is EPSG:900913
					externalProjection: map.displayProjection // which is EPSG:4326
				});
                
And this works, but it does ONLY work for Points, but not for LineStrings...

I did an test case for you, so you can try it and/or read the code.

http://socib.es/~jllodra/workspace/cdrift/kml_google.html

1 - take the pen tool, draw a point, drag your mouse over the point, coords
will appear in lat/lon. (correct)
2 - take the poly or line tool, repeat steps and coordinates will be in
meters. (not correct)

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Writing-KML-Reprojection-problem-tp6578255p6578255.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list