1

I want to work with JSON behind TypeScript interfaces but I'm not sure what the spec should be outside of GeoJSON. Is there a spec which is more encompassing then GeoJSON and includes things like a GetCapabilities response?

For example, it is very obvious with ESRI because ArcGIS Server services have built-in json support via adding a query string. For example, http://sampleserver3.arcgisonline.com/ArcGIS/rest/services?f=json&callback=foo

But GeoServer limits json support to GetFeature/GetFeatureInfo requests so it's not obvious what a GetCapabilies response might look like if a tool were to actually produce JSON.

So my question is this:

  1. Is GeoJSON format limited to spatial data?
  2. If so, is there any other JSON standards/schemas related to WFS/WMS services that is more encompassing?

NOTE: OpenLayers has WFS/WMS readers for various services. Presumably the resulting JSON conforms to some standard?

  1. https://github.com/openlayers/ol3/blob/master/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js
  2. https://github.com/openlayers/ol3/blob/master/test/spec/ol/parser/ogc/wmscapabilities_v1_0_0.test.js
  • I'm having trouble understanding your question. Is your Question: "Is GeoJSON format limited to spatial data'? or something more? I don't see how this fits into 'asking only practical, answerable questions based on actual problems that you face' – Devdatta Tengshe Dec 5 '13 at 15:30
  • The problem I'm facing is how to I represent WMS/WFS responses as JSON. – ca0v Dec 5 '13 at 15:36
  • What WMS/WFS responses do you want to represent? Both these stands were finalized before JSON was even though out. – Devdatta Tengshe Dec 5 '13 at 15:38
  • Well...the whole discovery process would be nice starting with GetCapabilities. DescribeFeatureType would be nice for building a query dialog. Is OL the best place to look for a JSON representation of these responses? – ca0v Dec 5 '13 at 15:43
  • 1
    Aren't you mixing the service and encodings? Both should be seen as totally independent: Any service should be able to handle any encodings, and vice versa. – julien Dec 5 '13 at 16:56
3

The WMS & WFS Standards have no JSON/GeoJSON output.

They require most requests and responses to be in XML or Key Value pairs. (see Table 2 of the WFS standards, for example)

JSON and GeoJSON are much later standards, and some Applications, like GeoServer provide GeoJSON as an output format for some of the operations, but that is something which is outside of the WMS/WFS standards, something specific to that particular software.

  • GeoJSON is limited to representing spatial data. OpenLayers is the only tool which represents this XML as JSON. I'm looking for someone to confirm this. – ca0v Dec 5 '13 at 16:01
  • What do you mean by: 'OpenLayers is the only tool which represents this XML as JSON'? OpenLayers will read the WFS features in XML and store them as JavaScript Objects. It's not the only one. There are some Leaflet Plugins that do that; So does the ESRI JavaScript API when it comes to WFS. – Devdatta Tengshe Dec 5 '13 at 16:20
  • ESRI is closed source. I'm unsure what leaflet plugin you mean but this one assumes JSON in the response: github.com/azgs/azgs-leaflet/blob/master/js/azgs-leaflet/… I'm becoming convinced OL is the definitive reference on converting "GeoXML" to JSON. I'm have a similar issue with SLD and see that OL has an answer to that as well (OpenLayers.Format.SLD). – ca0v Dec 5 '13 at 16:33
  • This leaflet example also assumes JSON from the server: github.com/Georepublic/leaflet-wfs/blob/master/index.html – ca0v Dec 9 '13 at 16:47
  • 1
    @ca0v; I can probably guess why your answer has got downvotes. I feel that your answer misses the point. JSON is a format of representing a JavaScript Object as a string. It doesn't matter how the Object was constructed. I personally have no experience with TypeScript, but since TypeScript is a strict superset of JavaScript, it should be able to parse XML. You are expecting WMS/WFS to be accessible via JSON, and the standards just doesn't mention JSON. Your best bet would be request the XML and then parse it. – Devdatta Tengshe Dec 10 '13 at 2:57
-2

No.

No definitive JSON interfaces exist for representing "GeoXML" outside of GeoJSON.

Here are incomplete interfaces for WFS GetCapabilities, GetFeature and SLD generated from JSON output from openlayers format readers that could be added to https://github.com/borisyankov/DefinitelyTyped/blob/master/openlayers/openlayers.d.ts:

  • Paste the WMS generated from OpenLayers.Format.WMS into json2ts.com and get Typescript Definitions! – ca0v Apr 11 '15 at 0:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.