[OpenLayers-Users] Problem with GML coordinates?

Jeff Dege jdege at korterra.com
Mon Jul 16 17:47:27 EDT 2007


I've been working with the OpenLayers.Layer.GML, and things have been
working, mostly.

I've been working with the default EPSG:4326 projection, but my users
don't like the looks of it.  (Decimal degrees are stretched,
left-to-right.)

So I've been trying to convert things to EPSG:102004.

My original GML files had been converted from shapefiles using ogr2ogr,
with no SRS specified.  Since the shapefiles had been in EPSG:4326,
everything was fine.

I created new GML files, specifying a conversion to EPSG:102004, set the
projection and units options in the OpenLayers.Map() constructor, and
nothing worked at all.  The generated map is a collection of
random-looking sharp spikes.

So I edited the GML file to cut it down to having only one rectangular
feature.  And OpenLayers drew it all catywhompus.

Comparing the GML file that worked to the GML that didn't, the one that
didn't had three-dimensional coordinates:

<gml:coordinates>
-634517.11999089224,691849.77929356066,0
-653761.64509297756,471181.53429472551,0
-673343.60852865304,250906.9515983529,0
-1088825.734430399,299284.85108220269,0
-1254041.3897117018,324729.27754874947,0 
-1235750.4212498858,434167.33911316615,0
-1190777.7803201093,704392.96327195223,0
-1181607.835811228,762236.29408003774,0
-634517.11999089224,691849.77929356066,0
</gml:coordinates>

The one that did had two-dimensional coordinates:

<gml:coordinates>
-104.05769844520292,44.997431638295993
-104.05312407321384,43.000582772448595
-104.05324668521079,41.001406996991136
-109.05007717114714,41.000661173718115
-111.04672699029817,40.997960720571911
-111.04669077447262,42.001566700961526
-111.04897415303213,44.47407102095351
-111.05519878435098,45.001322181741365
-104.05769844520292,44.997431638295993
</gml:coordinates>

When I edit the gml file that didn't work to remove the third dimension,
things draw just fine.

I'm no expert on the GML specification, but my expectation would be that
if the ogr tools can create GML files with three-dimensional
coordinates, then the GML specification probably allows for it.

In which case, OpenLayers.Layer.GML should probably cope with it, even
if it's only throwing the third dimension away.



More information about the Users mailing list