cityjson / specs

Specifications for CityJSON, a JSON-based encoding for 3D city models
https://cityjson.org
Creative Commons Zero v1.0 Universal
107 stars 25 forks source link

media type(s) in APIs #84

Closed cportele closed 2 years ago

cportele commented 3 years ago

We are working on CityJSON support in an API that implements OGC API Features and have a few questions:

Thanks!

hugoledoux commented 3 years ago

Great to hear that you are working on CityJSON support for OGC API Feature.

You should probably be aware that we had one student who finished an MSc thesis recently (link PDF + code not very cleaned...), but the aim was to mostly design the database so that features are served quickly. She didn't implement all the OGCAPIF specs, but the core follows it. Server was a done with Flask, which allows streaming too. Maybe this help?

Media type

No I didn't really consider this since I didn't think CityJSON was important enough for this, but now that you mention it, maybe I should apply. Also because now it's an OGC community standard. I'll think of this more... I guess you recommend us doing this?

v1.1 timeline

The draft is more or less finished, in branch "v1.1" in the specs folder you have the text (compiled there). We're currently testing and updating cjio (it will take a CityJSON and spit out a json-seq of CityJSONFeature).

We plan to release v1.1 in the fall.

I don't expect big changes from the current status, so you can start now I'd say. But this is where the feedback of the OGCAPIF team would be very useful, do you see things that could be improved?

evetion commented 3 years ago

With regards to media types, I roughly see the following options:

Note that the ;parameter=value could be applied to any of the above.

evetion commented 3 years ago

Note that there are currently no OGC specific media types registered. In the past standards like WFS just used text/xml and the newer REST based specs use application/json.

I could imagine OGC as vendor in these media types, like application/vnd.ogc.city+json, but this would also work for OGC API Features: application/vnd.ogc.api.feature+json?

cportele commented 3 years ago

Thanks for the responses, and thanks for the link to the thesis. I will read it to see, if we can learn something for our implementation, which will be different, because there is already a database and CityJSON will not be the only output format.

Yes, I would recommend to register a media type (and a separate one for the text sequences encoding). Otherwise there is no proper way for clients to know that the API will provide data in CityJSON or that a response is CityJSON and not some other JSON format for features.

By the way, OGC has so far registered 3 media types for encodings (GML, GeoPackage and GeoXACML): application/gml+xml, application/geopackage+sqlite3, application/geoxacml+xml. Since CityJSON is now an OGC Community Standard it should also be possible to register a media type in the standards tree through OGC, but another option could be a registration in the vendor tree (as OGC or TU Delft).

For the JSON encoding of resources defined in OGC API standards we had briefly discussed registering one or more media types, but so far always decided against it, as this did not seem necessary so far. (I expect that this will change in the future once resources are reused outside of an API context, but this will require a better understanding to decide what to register and how to name it.)

Regarding the 1.1 timeline: good to know, I think we will go ahead and implement CityJSONFeatures and text sequences. It should be straightforward to do. I will get back, if I find any issues. So far, I have two observations:

hugoledoux commented 2 years ago

I have applied 3 days ago for a media type with iana, I applied for application/city+json.

I'm waiting to hear from them, will update here.

hugoledoux commented 2 years ago

okay it's just been approved: https://www.iana.org/assignments/media-types/application/city+json

I haven't applied for city+json-seq because it's only in v1.1, which is not a standard of the OGC (yet), and the approval is only doable through the OGC.