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

Adding map API #5

Closed
ajakubo1 opened this issue Dec 12, 2016 · 21 comments
Closed

Adding map API #5

ajakubo1 opened this issue Dec 12, 2016 · 21 comments
Assignees

Comments

@ajakubo1
Copy link
Contributor

Any suggestions on map API?

Google maps seem to be a sensible choice, as those are free for non-profit applications:

https://developers.google.com/maps/pricing-and-plans/#details

Do you know of any other sensible map alternative?

@zen
Copy link
Member

zen commented Dec 13, 2016

OpenStreetMap - but I'm not sure if they have API.

I'm in general OK with Google, but it would be great to make it pluggable.

@ajakubo1
Copy link
Contributor Author

You mean in case we want to swap it?

Yeah, no problem, I'll try to abstract it :).

@zen
Copy link
Member

zen commented Dec 13, 2016

Yes. Google changed their different policies many times, I would not rely on this for 100%

@ajakubo1
Copy link
Contributor Author

Hmm, this one looks quite interesting as well: http://leafletjs.com/

And they did a stable release 1.0.0 a couple of months ago.

@zen
Copy link
Member

zen commented Dec 13, 2016

Yeah, that looks pretty cool and it's really lightweight. I would give it a try

@lechup
Copy link
Contributor

lechup commented Dec 14, 2016

It's open source so I think we should go leaflet + OSM.

PS: I hope we do not need to host OSM map service? ;)

@lechup
Copy link
Contributor

lechup commented Dec 14, 2016

Oh, and I assigned @ajakubo1 to this issue. Any objections? :)

@ajakubo1
Copy link
Contributor Author

Nope, none at all. I'll read up and create a prototype :).

@lechup
Copy link
Contributor

lechup commented Dec 27, 2016

@ajakubo1 do we want to host tile service connected to Leaflet?

I've checked pricing for Mapbox:
https://www.mapbox.com/pricing/

And it looks much more expensive than Google's Map API (checking free app/web):
https://developers.google.com/maps/pricing-and-plans/#details

We have 30*25000 monthly limit on Google, 50000 monthly limit on mapbox ...

Maybe we should stick to Google Maps?

@ajakubo1
Copy link
Contributor Author

Hi, @lechup - for now I'm using OpenMaps from what I know. I have some problems with the build configuration though (not because of OpenMaps, integration with webpack+react is little bit weird to me) :/. I should have something usable by the end of the week.

@lechup
Copy link
Contributor

lechup commented Dec 27, 2016

Ok, cool. Do You mean OSM? Like here? https://switch2osm.org/using-tiles/getting-started-with-leaflet/

What limits does it have? Is it usable? I mean it is not sluggish and loads quite fast?

@ajakubo1
Copy link
Contributor Author

ajakubo1 commented Dec 29, 2016

@lechup yeah, that's the one.

I can see that they suggest using your own data server:

https://operations.osmfoundation.org/policies/api/

And is it sluggish? Well, to tell you the truth I don't feel it's sluggish. The whole thing takes a second to load :).

I think I've handled most problems I had. Things left to do:

  • Sort-out component struture and add code to display pins properly

  • Add a fetch library + a polyfill

  • create Redux actions/reducers + appropriate libraries which make life easier (Like Immutable)

  • take care of test problems (build fails because of that)

  • Add tests :)

    • Adding tests for DataHolder and SmogMap components

I'll do some of those today I think :).

@lechup
Copy link
Contributor

lechup commented Dec 31, 2016

@ajakubo1 ok, so for first version we just use their tiles service right? Then we could write to API holders whether we should get our solution or not.

I could set up OSM tile service, but still we would need to proxy it through our backend and require token (and timestamp?) to actually do not let to abuse it...
http://stackoverflow.com/a/31640941/479931

I do not have any idea what kind of HW do we need for our usage but still it is doable - but increases running costs a bit...

@ajakubo1
Copy link
Contributor Author

ajakubo1 commented Jan 2, 2017

@lechup Yeah, I think we can use theirs for now, but I would have the OSM tile service in the back of my head. To tell you the truth that's something which @zen should consider more (as he would deploy it all, I think ;)).

Anyway, if you have a couple of seconds you can checkout this branch: https://github.com/EnviroMonitor/EnviroMonitorFrontend/tree/adding_map

I have a feeling this pull request might be quite big, but I want to add everything which we might need in futther development.

Anyway, if I add the fetch library, and input some test data, I'll open the pull request for it.

@zen
Copy link
Member

zen commented Jan 2, 2017

Folks, I can set up tile server if that's needed. Just let me know if we run into any perf problems with current setup. Still, that's fine for our global instance, but what about users deploying their own backend/frontend? It can be a showstopper for them :(

@ajakubo1
Copy link
Contributor Author

ajakubo1 commented Jan 2, 2017

For internal usage (I mean one person wants to set it up and has like 2 sensors or something), it should be fine using the global OSM. But - if our project would be used for country-wide-monitoring or city-wide-monitoring, then I guess we would have to suggest setting up their own OSM tile service for performance.

I'm not sure if we should block the page somehow for bigger traffic? Nah, that would be weird, it's open-source anyway :). So anyone can hack it in their own branch.

BTW - I'll check what is the current page size with map fully loaded.

@lechup
Copy link
Contributor

lechup commented Jan 2, 2017

@zen @ajakubo1 Shouldn't we go into way we are hosting all instances? I mean we could support local Smog Alarm Groups:

  • allow other pages integration through iframe - map tiles + sensors + stats (token auth)
  • allow integration through API (token auth), so user could present his data on Google Map or whatever tile service?

I think it will be much more user friendly than "set up Your own soft infrastructure". What do You think guys?

@zen
Copy link
Member

zen commented Jan 2, 2017

I'm all for hosting it for others, and maybe you are right that if someone chooses to host it himself, it's out of our scope.
So, I would assume that we host central instance and allow users to set up their own frontend to use our data. They need to post some sensor data though, to get access to resources.

@ajakubo1
Copy link
Contributor Author

ajakubo1 commented Jan 3, 2017

Yeah, I'm OK with setting up our own server and allowing users to use it, if they are contributing to the overall data scope. That's quite user-friendly, and everyone is getting something out of it :).

Btw. I've just checked and the whole thing weights about 1.1 MB. And half of that is our scripts (well, mostly vendor scripts really). On my modem it takes about 2s to load right now (last time I've checked I've had better connection).

@lechup
Copy link
Contributor

lechup commented Jan 4, 2017

@ajakubo1 1.1 MB - I think we should go with some kind of loader for slower connections. React apps just need some more data at the beginning but later it just works.

@lechup
Copy link
Contributor

lechup commented Feb 7, 2017

Done in #15

@lechup lechup closed this as completed Feb 7, 2017
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

3 participants