OpenLayers format reading speed - simple feature (v2)

Revision 2 of this benchmark created by Tondo on


Description

Geometry - Point Thematic attributes - None

Preparation HTML

<script src="http://openlayers.org/api/2.13.1/OpenLayers.js"></script>
<script type="text/javascript">
var formats = {
  wkt: new OpenLayers.Format.WKT(),
  geojson: new OpenLayers.Format.GeoJSON(),
  georss: new OpenLayers.Format.GeoRSS(),
  gml2: new OpenLayers.Format.GML.v2(),
  gml3: new OpenLayers.Format.GML.v3(),
  kml: new OpenLayers.Format.KML(),
  gpx: new OpenLayers.Format.GPX(),
  ep: new OpenLayers.Format.EncodedPolyline()
};

var data = {
  wkt: "POINT(100 0)",
  geojson: {
    "type": "Feature",
    "properties": {},
    "geometry": {
      "type": "Point",
      "coordinates": [100, 0]
    },
    "crs": {
      "type": "name",
      "properties": {
        "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
      }
    }
  },
  georss: "<item xmlns='http://backend.userland.com/rss2'><title></title><description></description><georss:point xmlns:georss='http://www.georss.org/georss'>0 100</georss:point></item>",
  gml2: "<gml:featureMember xmlns:gml='http://www.opengis.net/gml' xsi:schemaLocation='http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><feature:feature xmlns:feature='http://example.com/feature'><feature:geometry><gml:Point><gml:coordinates decimal='.' cs=', ' ts=' '>100, 0</gml:coordinates></gml:Point></feature:geometry></feature:feature></gml:featureMember>",
  gml3: "<gml:featureMember xmlns:gml='http://www.opengis.net/gml' xsi:schemaLocation='http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><feature:feature xmlns:feature='http://example.com/feature'><feature:geometry><gml:Point><gml:pos>100 0</gml:pos></gml:Point></feature:geometry></feature:feature></gml:featureMember>",
  kml: "<kml xmlns='http://earth.google.com/kml/2.0'><Folder><name>OpenLayers export</name><description>Exported on Sun Aug 11 2013 14:40:22 GMT+0200 (Central Europe Daylight Time)</description><Placemark><name>OpenLayers_Feature_Vector_67</name><description>No description available</description><Point><coordinates>100, 0</coordinates></Point></Placemark></Folder></kml>",
  gpx: "<gpx xmlns='http://www.topografix.com/GPX/1/1' version='1.1' creator='OpenLayers' xsi:schemaLocation='http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><wpt lon='100' lat='0'><name>OpenLayers_Feature_Vector_67</name><desc>No description available</desc></wpt></gpx>",
  ep: "?_gjaR",
};

function deserialize(format) {
  return formats[format].read(data[format]);
}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
WKT
deserialize("wkt");
ready
GML v2
deserialize("gml2");
ready
GML v3
deserialize("gml3");
ready
KML
deserialize("kml");
ready
GeoJSON
deserialize("geojson");
ready
GeoRSS
deserialize("georss");
ready
Encoded Polyline
deserialize("ep");
ready
GPX
deserialize("gpx");
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.