[Plugin: Events Manager] Other map
-
Hi! How I can integrate event location with openstreetmap or yandexmaps? Our city does not written on google maps ??
-
not possible at the moment however you might want to try this tutorials https://wp-events-plugin.com/tutorials/modifying-event-location-google-maps/
we’d not plan on doing this, so you’d have to hack this yourself. possible, but requires a decent amount of hooking into EM and php.
Hi! I had the same issue: Google Maps provided way too little information for some of the locations I had, while OpenStreetMap has a plethora of information (even the ones in NYC, which is astonishing!).
There is also another more serious issue: Google Maps licensing. It is vaguely described as being allowed to be used for all “free” uses. This means that a publicly viewed blog, which has no source of income (except perhaps Google Ads!), has no problem viewing Google Map data.
However, in my case, I have a customer with a website which shows events. They’re considering to allow people to register and pay for the events, and this means going Pro with Events Manager. Now, this is not really an application providing information on top of the Google Maps API, so in theory, at least, it should be fine to use Google Maps for this. But a good Google lawyer may be able to prove in court that the location data is used to drive visitors to pay to attend events, since, for all purposes, if the potential end-user doesn’t know where the event is held, and has no easy way to figure it out on a map, they might not buy access to the event. On the other hand one might argue that Google will “never find out” so the whole question is moot — the organisation is too tiny. I know this is a bit convoluted, so bear with me — we’re talking about tiny organisations without money to pay for legal advice and being thus unable to fight Google in court. If Google, by some unlucky chance, “finds” out about this website using Events Manager to provide maps and location services for paid access to events, and considers it a license break, and sues, what shall my customer do? They will sue me instead, and I cannot argue that it’s not my fault, it’s Events Manager’s fault for using Google Maps, I’m just a developer…
So to be sure I’m not liable to commit any violations on Google Maps’ licensing terms, the safest bet is to use OpenStreetMap, which has no restrictions whatsoever.
Now, as @marcus pointed out, removing Google Maps and using OpenStreetMap is way too much trouble for a poor programmer like me. I understand that most of the heavy-duty calls are happening under /events-manager/includes/js/events-manager.js, but this is so closely tied to all other parts of the code that it would be a nightmare to change ana maintain.
I thus opted for a simpler solution. One thing is accessing Google Map tiles, which is licensed for “free use” only. The other thing is using the JS library itself, which is licensed differently. One can use Google’s library to fetch OpenStreetMaps tiles. This article explains how: https://wiki.openstreetmap.org/wiki/Google_Maps_Example
Adapting this on events-manager.js is not too hard. The call is made thrice (just search for new google.maps.Map and add the relevant bits from the article above). Once that is done, make sure that you clear all caches, etc. (or de-activate EM and activate it again; in my case, I had to force a version change to make sure the new JS file is loaded). EM will now use OpenStreetMaps tiles instead of Google Map tiles. It will still show Google’s logo, but the tiles are for sure coming from OSM and not Google ??
If someone wants the hacked version, I’d be more than happy to send it.
I’m going to try to catch a EM developer and send the code to them as well. With a little more effort from their part, the JS can be slightly modified to have a checkbox on the EM plugin settings to use OSM and/or Google map tiles, and get the JS to check for the option and add the appropriate code. This is really very easy to do and doesn’t require “a decent amount of hooking into EM and php” but rather just a few lines.
One might claim that this is not a perfect solution. After all, some code is still used from Google’s libraries, and a very tricky and nasty Google lawyer might still find a way to complain. The solution, of course, is to get rid of Google’s map displaying library entirely. This is also not an overwhelming change. Leaflet, which has a simple BSD license, and which is independently developed, is a small (27 KB of compressed JS) library which pretty much replicated Google’s functionality and it even allows a lot of styling. To make developers happy, to the best of my knowledge, Leaflet even uses very similar library calls than Google’s own, with method names being the same or close enough to be perceptible. Leaflet, of course, can also call either Google Map tiles, OpenStreetMap tiles, or any kind of tiles as well (it can even attempt to use one kind of tiles and “fall back” to a different kind if the first is unavailable for some reason). So while it’s not a “drop-in replacement” for Google’s own JS library, it’s probably the closest there is.
I didn’t replace everything with Leaflet’s calls, for two reasons. First, this requires some “decent amount” of effort (even if at the PHP layer of EM, it should be transparent enough; very likely, only events-manager.js needs to be changed), specially in debugging (as EM is a commercial plugin, I’m sure their customers expect a bug-free plugin). And secondly, one of the nice features of Google’s JS calls is the location service — put an address on the WP backoffice for EM, and it will search the appropriate location for it. Leaflet, by itself, doesn’t do that. OpenStreetMap provides several location services with an API to it, but the calls are obviously different from Google’s own. Of course one could use Google’s location service to find the latitude and longitude of an address, and then only rely on Leaflet + OpenStreetMap to display map tiles. But Google’s license would still apply to the location services! So a full “replacement” solution will need to replace both things. This currently is beyond my feeble programming skills and would take a lot of time to change and develop ??
For now, the best choice is simply to use Google’s JS library and fetch OpenStreetMap tiles with it. But as the map wars continue to increase in intensity and scale, at some point, anyone providing mapping services using a commercial digital mapping service should be aware of license restrictions in doing so and offer an alternative. While there are a few alternatives, OpenStreetMap at least has close to a million volunteers mapping the whole world, and, right now, it beats Google at lots of locations with far more data — even on places where Google usually is unbeatable, namely, cities like New York.
It’s worth taking this into account on future releases of Events Manager — it should be part of the roadmap.
I’d rather not get into details on the legalities because I think Google has much better stuff to do than go after people using their Google maps service at these levels. I hope so, because we have better stuff to do than worry about this.
In that 5 years or so of this plugin, Google hasn’t complained. If you’re going to use Google maps on a high traffic site, I’m pretty sure it’s your (i.e. the site owner) responsibility to make sure you’re within the usage limits.
that said, EM is very flexible so you could send me an add-on probably without hacking any of our plugin which would effectively replace the google map placeholders and use another service.
i intend to add a ‘community add-ons’ section at one point that’d include snippets like this to modify behavious, I’d happily consider adding this sort of thing there.
Thanks for the swift reply, Marcus! I so totally agree with you, but, unfortunately, I have had reasons to be suspicious about Google’s misaligned intentions — a reason why you might have noticed that I don’t have an active Google+ profile, in spite of being their customer (yes, customer, not merely a user) since late 2004 or so.
It’s really excellent news that Google hasn’t complained and perhaps I simply just worry too much. I’m sure that the ones to be blamed would always be the users of EM — i.e. your customers — and not EM by itself. If something happens, though, it will be Google pestering my own client, and they, in turn, will pester me — and I have either to pay or to provide an alternative. I prefer to get prepared for the worst-case scenario, though, and have the alternative ready!
EM is indeed flexible! Right now, however, all I can do is point you to the modified remote-manager.js — it’s being publicly shared here: https://docs.google.com/document/d/13hxRWdgNlkG6M7RzHrxq4UwQgp0OLFJmOQl22ACYlzo/edit
As said, all this does is replace tile fetching, getting them from OpenStreetMap instead of Google. I have not modified anything else.
I believe it’s within my capabilities to develop a two-line plugin that “removes” the standard remote-manager.js from the added scripts and replaces it with the modification allowing OpenStreetMap tiles to be fetched. I might have some time to do that next week. The advantage, of course, is that this would not need any modification of EM’s excellent code. The disadvantage is that with each new version of EM I would obviously need to provide a new, changed remote-manager.js to work with the latest version.
A better solution, as said, would be to replace the Google Map library which you use with Leaflet’s own and add an option somewhere to allow WP admins to select which kind of tiles they wish to display — Leaflet being able to retrieve tiles from pretty much everything out there (in fact, just like Google’s library). This requires a lot of thinking on my side. I’m a pretty slow programmer! And, of course, it will also require making sure this add-on stays “in sync” with further EM releases. Assuming there is actual demand for this sort of thing, I’d consider working it out into a plugin…
It’s a great idea to have a “community add-ons” section! ??
- The topic ‘[Plugin: Events Manager] Other map’ is closed to new replies.