GeoJSON input should accept 3D coords, p=sgillies, r=me (closes #2070)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9700 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -24,6 +24,13 @@
|
||||
*/
|
||||
OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
|
||||
|
||||
/**
|
||||
* APIProperty: ignoreExtraDims
|
||||
* {Boolean} Ignore dimensions higher than 2 when reading geometry
|
||||
* coordinates.
|
||||
*/
|
||||
ignoreExtraDims: false,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.GeoJSON
|
||||
* Create a new parser for GeoJSON.
|
||||
@@ -269,8 +276,9 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
|
||||
* {<OpenLayers.Geometry>} A geometry.
|
||||
*/
|
||||
"point": function(array) {
|
||||
if(array.length != 2) {
|
||||
throw "Only 2D points are supported: " + array;
|
||||
if (this.ignoreExtraDims == false &&
|
||||
array.length != 2) {
|
||||
throw "Only 2D points are supported: " + array;
|
||||
}
|
||||
return new OpenLayers.Geometry.Point(array[0], array[1]);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user