matthew-sochor-zz / fish.io.ai

Krillin' it since 2017
MIT License
4 stars 3 forks source link

Geocoding fish #12

Open MattGraz opened 7 years ago

MattGraz commented 7 years ago

Found: https://github.com/rochacbruno/Flask-GoogleMaps

Examples with code:

http://flaskgooglemaps.pythonanywhere.com/

I'll try playing around with this and getting something integrated.

thenomemac commented 7 years ago

Don't want to influence things to much but Geo coding I don't think is the problem. There's packages that convert lat long to state or city and don't require depends on Google API. We just need the jQuery or whatever js code to get the default browser but in location prompt then ajax post it. Probably 10 lines max of straight js. For now we can just add a dummy flask post rout that takes two floats and just always return Ohio rules cause that's all we have anyways.

On Apr 5, 2017 7:39 PM, "MattGraz" notifications@github.com wrote:

Found: https://github.com/rochacbruno/Flask-GoogleMaps

Examples with code:

http://flaskgooglemaps.pythonanywhere.com/

I'll try playing around with this and getting something integrated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matthew-sochor/fish.io.ai/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AOeuWqz6sVDKUOEsquJAvu5j2u1HIWETks5rtCY1gaJpZM4M08d_ .

thenomemac commented 7 years ago

Also for mapping we can plot all the points in our database with leaflet js. It's super light weight and works off any dumb http get route with Json. But maybe the Google extension does all this too? Let's code make sure it's actively maintained.

On Apr 5, 2017 7:44 PM, "Josiah Olson" thenomemac@gmail.com wrote:

Don't want to influence things to much but Geo coding I don't think is the problem. There's packages that convert lat long to state or city and don't require depends on Google API. We just need the jQuery or whatever js code to get the default browser but in location prompt then ajax post it. Probably 10 lines max of straight js. For now we can just add a dummy flask post rout that takes two floats and just always return Ohio rules cause that's all we have anyways.

On Apr 5, 2017 7:39 PM, "MattGraz" notifications@github.com wrote:

Found: https://github.com/rochacbruno/Flask-GoogleMaps

Examples with code:

http://flaskgooglemaps.pythonanywhere.com/

I'll try playing around with this and getting something integrated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matthew-sochor/fish.io.ai/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AOeuWqz6sVDKUOEsquJAvu5j2u1HIWETks5rtCY1gaJpZM4M08d_ .

MattGraz commented 7 years ago

From @matthew-sochor : http://www.mrc-productivity.com/techblog/?p=1082

Looks like this guy has exactly what we need.

MattGraz commented 7 years ago

FYI, I got a google API key for our app if we need it.

thenomemac commented 7 years ago

cool beans

MattGraz commented 7 years ago

@thenomemac, @matthew-sochor

I'm getting an error that some of the methods needed to geocode don't work on "insecure origin". AKA, we need to use HTTPS in lieu of HTTP. I assume this is an easy-ish conversion to do? Being a complete noob at web dev I don't have much context, though.

thenomemac commented 7 years ago

maybe easy-ish? not sure why you need to be https to use an api? that doesn't sound right? maybe because you're in debug mode? I'm biased for deving minimal solution where we just focus for the demo tomorrow on figuring out how to get JS to trigger the allow location dialog. then we fake the locations API for now and have it hard coded to CLE. Thoughts?

On Wed, Apr 5, 2017 at 9:35 PM, MattGraz notifications@github.com wrote:

@thenomemac https://github.com/thenomemac, @matthew-sochor https://github.com/matthew-sochor

I'm getting an error that some of the methods needed to geocode don't work on "insecure origin". AKA, we need to use HTTPS in lieu of HTTP. I assume this is an easy-ish conversion to do? Being a complete noob at web dev I don't have much context, though.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/matthew-sochor/fish.io.ai/issues/12#issuecomment-292044241, or mute the thread https://github.com/notifications/unsubscribe-auth/AOeuWhQ1L0jn1oo-Ht1Dguc0syxEzegOks5rtEFGgaJpZM4M08d_ .

MattGraz commented 7 years ago

I keep getting an error on the geocoding functions saying the functionality is disabled on "insecure origins" and the error recommends using https to circumvent these challenges. If you know of a way around, I'm open to suggestions. It may certainly be possible, but I've been unable to get it working.

thenomemac commented 7 years ago

Hmm we may have to get https certificates for our app. Can you do it from the PC browser to test it for now? Not sure how fast I can get those setup.

On Apr 5, 2017 10:11 PM, "MattGraz" notifications@github.com wrote:

I keep getting an error on the geocoding functions saying the functionality is disabled on "insecure origins" and the error recommends using https to circumvent these challenges. If you know of a way around, I'm open to suggestions. It may certainly be possible, but I've been unable to get it working.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/matthew-sochor/fish.io.ai/issues/12#issuecomment-292049308, or mute the thread https://github.com/notifications/unsubscribe-auth/AOeuWuv9_9UKUOFhb56ec1dthxNNpXVFks5rtEnGgaJpZM4M08d_ .

MattGraz commented 7 years ago

I've been using purely PC thus-far. I'll keep chugging away for a little bit here and see if I can get a breakthrough.

MattGraz commented 7 years ago

Per https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only?hl=en

Starting with Chrome 50, Chrome no longer supports obtaining the user's location using the HTML5 Geolocation API from pages delivered by non-secure connections. This means that the page that's making the Geolocation API call must be served from a secure context such as HTTPS.

MattGraz commented 7 years ago

https in flask: http://flask.pocoo.org/snippets/111/

Generating Certs: http://werkzeug.pocoo.org/docs/0.11/serving/

thenomemac commented 7 years ago

I see makes sense for security reasons. We can get HTTPS certs for our app. Just not sure I can get them setup yet tonight. Might I suggest you google the problem of spoofing/generating certs for "tests" and "dev" and see if that works. If you figure it out please contrib. FYI I know for a fact mozilla gives free certs. So it may not be too hard to get some from them.

MattGraz commented 7 years ago

Totally understandable. I think the links I posted above may be the answer so I'm going to give those a shot and see what happens.

MattGraz commented 7 years ago

We can launch with:

from werkzeug import run_simple

run_simple('localhost', 5000, app,
           ssl_context='adhoc')

Werkzeug will generate some ssl certs for local running/debugging. It isn't a long term solution but should at least allow us to iterate

thenomemac commented 7 years ago

ya our resumes are growing. we're web security experts and data scientists now.

matthew-sochor-zz commented 7 years ago

speak for yourselves I've done jack shit so far with the web app. Resume fail 👎

MattGraz commented 7 years ago

I bolded some text and centered an image. I'll count it haha.

@thenomemac: I got https: running on local host

* Running on https://localhost:5000/ (Press CTRL+C to quit)

thenomemac commented 7 years ago

sweet does the geocode stuff work now

MattGraz commented 7 years ago

Working on it now

MattGraz commented 7 years ago

I think my problem is that I can't get Jinja to install correctly.

dependencies: https://github.com/rochacbruno/Flask-GoogleMaps

thenomemac commented 7 years ago

Jinja is installed by default with flask... are we sure this extension is upto date with latest flask version?

MattGraz commented 7 years ago

Alright, then I have no idea how to get this thing going :/

@matthew-sochor, @thenomemac I'll toss in a temporary image for place holding so we can demonstrate what our vision was at the demo.

thenomemac commented 7 years ago

So who's doing this. Think this is must have

thenomemac commented 7 years ago

Maybe dev it under the SSL certificates. Once I get a couple other features added I'll look into getting us public certs from Mozilla