Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obtaining a list of geohashes representing neighborhoods zones #234

Open
IsamAljawarneh opened this issue Nov 16, 2018 · 2 comments
Open

Comments

@IsamAljawarneh
Copy link

Hi Ram,
very interesting project.
so, i have a DF with neighborhoods represented as ZCurves in index column:

var index1 = neighborhoods.withColumn("index", $"polygon" index 30)
how to obtain the list of geohashes that represent each zone instead.
same issue as mentioned here:
#193
he said he could solve it using the toBase32 function but he did not mention how.

can you tell me how to use this functionality (for example with my index1 dataframe above)

thanks a lot and wishing all the best for the project.

@harsha2010
Copy link
Owner

hey!
A ZOrderCurve has a function called .toBase32() that returns the geo hash string (which is nothing but a base 32 encoded string).
So all you'd need to do is write a UDF that does something like
geohashUDF = udf{(curve: Seq[ZOrderCurve]) => curve.map(_.toBase32())} and use it as:
df.withColumn("geohashes", geohashUDF($"index.curve"))

I haven't tested the above syntax but morally it should do the right thing...

@IsamAljawarneh
Copy link
Author

Thanks Ram.
i will test it as soon as possible and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants