Code Monkey home page Code Monkey logo

geohex's People

Contributors

chsh avatar franzhcs avatar ilyabo avatar mattak avatar shishkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geohex's Issues

size and innerRadius are confusing as they don't account for Mercator distortions

When measured in lat/lon degrees (or meters) the vertical and horizontal sizes of a hexagon are not the same because of the Mercator distortions. From the API documentation it is not clear what sizes size and innerRadius actually represent.

The API should clarify that and ideally provide means for obtaining sizes along the two axes. For example, the functions below give outer sizes for both axes (but don't account for wrapping at antimeridian and poles):

const zoneSize = (z, accessor) =>  {
  let [ a, b ] = d3.extent(z.geometry, accessor)
  return (b - a) 
}

const zoneHeight = (z) => zoneSize(z, d => d.lat)

const zoneWidth = (z) => zoneSize(z, d => d.lon)

Also z.size seems to return half of the outer radius (zoneWidth) contrary to the documentation which states that it is the side length

let z = terahex.decode('130046352')
z.size * 2                 // 2.469135802469136 
z.geometry[0].lon - z.geometry[3].lon     // 2.469135802469168

bintray sunset

having new problems using this, and I think it's related to bintray being sunsetted.

[error] https://dl.bintray.com/teralytics/maven/net/teralytics/geohex_2.12/0.1.128/geohex_2.12-0.1.128.jar: download error: 
Caught java.io.IOException: Server returned HTTP response code: 403 for URL: 
https://dl.bintray.com/teralytics/maven/net/teralytics/geohex_2.12/0.1.128/geohex_2.12-0.1.128.jar (Server returned HTTP 
response code: 403 for URL: https://dl.bintray.com/teralytics/maven/net/teralytics/geohex_2.12/0.1.128/geohex_2.12-
0.1.128.jar) while downloading https://dl.bintray.com/teralytics/maven/net/teralytics/geohex_2.12/0.1.128/geohex_2.12-
0.1.128.jar

is anybody maintaining this or interested in publishing to Sonatype OSSRH and then Maven Central?

NoSuchElementException due to the presence of Cell(2,-2) in an Hexagon but not in the `dictionary`

NoSuchElementException due to the presence of Cell(2,-2) in an Hexagon but not in the dictionary. The dictionary is defined as following:

val dictionary = IndexedSeq(
      Cell.subS,
      Cell.subSW,
      Cell.subW,
      Cell.subSE,
      Cell.subCenter,
      Cell.subNW,
      Cell.subE,
      Cell.subNE,
      Cell.subN)

The following snippet reproduces the bug:

import net.teralytics.terahex.{Encoding, Grid, Lat, LatLon, Lon, Zone}

implicit val grid = Grid(0.00224579  *  19683)

  val zones =
    Zone.zonesWithin(LatLon(Lon(51.55d), Lat(26.55d)) -> LatLon(Lon(56.55d), Lat(22.55d)), 9)

  val z = zones.head

  implicit val encoding = Encoding.numeric

  print(zones(1).code)

I end up with the following exception:

Exception in thread "main" java.util.NoSuchElementException: key not found: Cell(2,-2)
	at scala.collection.MapLike$class.default(MapLike.scala:228)
	at scala.collection.AbstractMap.default(Map.scala:58)
	at scala.collection.MapLike$class.apply(MapLike.scala:141)
	at scala.collection.AbstractMap.apply(Map.scala:58)
	at net.teralytics.terahex.Encoding$$anon$1$$anonfun$encode$1.apply(Encoding.scala:42)
	at net.teralytics.terahex.Encoding$$anon$1$$anonfun$encode$1.apply(Encoding.scala:42)
	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
	at scala.collection.immutable.List.foldLeft(List.scala:84)
	at net.teralytics.terahex.Encoding$$anon$1.encode(Encoding.scala:42)
	at net.teralytics.terahex.Encoding$$anon$1.encode(Encoding.scala:17)
	at net.teralytics.terahex.package$ZoneOps$.code$extension(package.scala:14)
	at ae.du.populationdensity.PopulationDensityApp$delayedInit$body.apply(PopulationDensityApp.scala:53)
	at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
	at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
	at scala.App$$anonfun$main$1.apply(App.scala:71)
	at scala.App$$anonfun$main$1.apply(App.scala:71)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
	at scala.App$class.main(App.scala:71)
	at ae.du.populationdensity.PopulationDensityApp$.main(PopulationDensityApp.scala:17)
	at ae.du.populationdensity.PopulationDensityApp.main(PopulationDensityApp.scala)

JS exceptions trying to access code of zones close to antimeridian or north pole

> t.zoneByLocation(-177.77777777777777, 82.77472507444895,5).code
java.util.NoSuchElementException: key not found: Cell(-2,0)
> t.zoneByLocation(-22.22222222222223, 88.55526595063087, 5).code
java.util.NoSuchElementException: key not found: Cell(-1,-1)

Just getting the zone works, but trying to access the code prop leads to exceptions. It would be more reasonable if exceptions were already thrown when calling zoneByLocation. This way it would be easier to track and remove unsupported hexagons.

> t.zoneByLocation(-22.22222222222223, 88.55526595063087, 5)
{ hb: 
   { Eb: 300,
     Rb: { rd: [Object], xd: [Object] },
     Yb: { Eb: 300 },
     zc: 5,
     Ee: 1.234567901234568,
     Xi: null,
     ma: false },
  zc: 5,
  Ee: 1.234567901234568 }
> t.zoneByLocation(-22.22222222222223, 88.55526595063087, 5).code
java.util.NoSuchElementException: key not found: Cell(-1,-1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.