koopjs / koop

Transform, query, and download geospatial data on the web.
http://koopjs.github.io
Other
651 stars 125 forks source link

Provider method for metadata #524

Open rgwozdz opened 1 year ago

rgwozdz commented 1 year ago

From @efbenson:

As I play around with getting the related layers working with a custom provider it feels like returning massive metadata and other "configuration" data on the geojson object is getting to be a bit cludgy. Maybe it would be possible to add some additional functions on the Model class for that. Something like getLayersConfiguration(host, id) or something like that where we could return the static configuration about the layers. IMO that would also provide a cleaner way of generating the data for the /layers rest endpoint

Originally posted by @efbenson in https://github.com/koopjs/koop/issues/386#issuecomment-1474312408

rgwozdz commented 9 months ago

I think this is a good idea. It will take some doing though.

  1. koop-core already includes pullLayer and pullCatalog methods. I think pullLayer was intended to get metadata for a layer. pullCatalog is a little ambiguous as a "catalog" in ArcGIS can mean a collection of data from various sources, but pullCatalog would only describe a single provider's "catalog". But if you think about this from the feature service perspective a provider's catalog might be built of many different "services" as defined by the providers URL parameters (i.e., id and or host). So pullCatalog might be difficult for providers to support. It might be better to go in a more generalized direction and add a pullMetadata method to Koop-core's model implementation, and have providers implement a getMetadata method.

  2. For use in FeatureServer, routes that could use pullMetadata would need a specialized handler as opposed the existing generalized handler that leverages pullData/getData. We would want to fallback to pullData/getData in the event that the provider doesn't include a getMetadata method.