jisantuc / fp-http-azavea-rd

0 stars 0 forks source link

Add hand-rolled JS geometry types to stac4s #3

Closed jisantuc closed 4 years ago

jisantuc commented 4 years ago

I worked with @pomadchin to try to cross-publish gt-vector in Scala JS and we ran into a few problems:

  1. ServiceLoader pattern might be hard
  2. reflection might not be allowed
  3. ScalaTest was exploding with a super unhelpful error message for every test suite

That's before we got to the problems that we thought in advance might be hard, namely:

  1. JTS dep
  2. geotools dep

Since stac4s in particular is mainly about the types and I won't need fancy geometry operations, and since mwundo is only published up through ScalaJS 0.6, it will instead make sense just to create geometry types in the js/ projects in stac4s that are sufficient for data transport and not worry about it, at least as a first cut.

pomadchin commented 4 years ago

Source for the context: https://www.scala-js.org/doc/semantics.html

Reflection

Java reflection and, a fortiori, Scala reflection, are not supported. There is limited support for java.lang.Class, e.g., obj.getClass.getName will work for any Scala.js object (not for objects that come from JavaScript interop).

pomadchin commented 4 years ago

I will leave also the GeoTrellis branch with the ScalaJS cross compilation try (for the recrods): https://github.com/pomadchin/geotrellis/tree/feature/scalajs