-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use pnnl-buildingid package for UBID encoding #24
Comments
Thanks for putting this together @markborkum , I'll update the code to use the official ubid npm package in the next few days or so. |
@agilliland, No problem! FYI: Please consider using a GEOS-derived package for centroid calculation. In many cases, turf.js does not give the same result as GEOS. For example, the geometry for AT&T Park in San Francisco (L156407 of the Socrata open dataset https://dev.socrata.com/foundry/data.sfgov.org/2s2t-jwzp):
GEOS: |
@markborkum your last comment definitely has me a bit more concerned given that a UBID doesn't work properly if we can't ensure everyone is calculating it the exact same way for a common polygon. Does the UBID spec reference a specific algorithm for how the centroid and bounding box of the polygon need to be calculated? If not then I think that should be considered as it seems imperative to ensuring consistency. Based on your reference to GEOS it looks like they have a few variants they support https://geos.osgeo.org/doxygen/classgeos_1_1algorithm_1_1Centroid.html If that is indeed the supported centroid algorithm for UBID then it should probably be referenced somewhere. |
@agilliland, The specification for the UBID encoding operation does not reference specific algorithms for the calculation of the latitude and longitude coordinates for the centroid (or for the calculation of the minimum bounding rectangle) because the UBID encoding operation receives these numbers as input. It is important to distinguish between the UBID string itself and assertions that contain a UBID string. Since UBID strings are endurants, all syntactically valid UBID strings are consistent. For example, by design, any syntactically valid UBID string can be decoded. However, the same is not necessarily true of assertions that contain UBID strings. For example, the provenance of a UBID assertion "UBID X was computed from geometry Y using algorithm Z" may be refuted. Best practice is for the data provider to document the provenance of their datasets (see https://www.dataone.org/best-practices/provide-citation-and-document-provenance-your-dataset for details). A relevant issue for the turf project is Turfjs/turf#334. I have created a new issue to document the algorithms that are used by the UBID Python package (see https://github.com/pnnl/buildingid/issues/7 for details). |
The data pipeline implements the UBID "encode" function (c.f., https://github.com/opencitymodel/data-pipeline/blob/master/footprints/prep-msfp/grid-and-attrs/app.js#L85).
The
pnnl-buildingid
package is available via npm (GitHub repository: https://github.com/pnnl/buildingid-js).To encode a UBID using the
turf
package to calculate the axis-aligned minimum bounding rectangle and center of mass for a GeoJSON primitive:The text was updated successfully, but these errors were encountered: