Home › Forums › Calendar Products › Events Calendar PRO › Can we add geolocation to find point of event on the map?
- This topic has 8 replies, 3 voices, and was last updated 9 years, 11 months ago by
Support Droid.
-
AuthorPosts
-
April 26, 2016 at 4:19 pm #1107430
fifteen15studios
ParticipantHi Modern Tribe,
We would like to have events added to the map view (in Advanced Filter Bar) automatically by reading the address. Is there a way to add a Google Geolocation API to the map so we can do this?
Thanks,
BrendanApril 26, 2016 at 10:43 pm #1107542Cliff
MemberHi Brendan.
I’m not sure I fully understand your request.
The PRO plugin does use the Google Maps Geocoding API to obtain the latitude/longitude coordinates for each Venue that has an address that Google can geocode.
Also, our iCal Importer has similar code to obtain the coordinates for a Venue when it’s imported.
Then our Map View displays events on a map (for the events assigned a Venue that has coordinates).
Maybe it’d be helpful for you to reference our Maps Settings and the Troubleshooting Map View article and let me know if you have any follow-up questions.
Thanks!
April 28, 2016 at 6:13 am #1108155fifteen15studios
ParticipantCliff,
Thanks for replying! I guess I didn’t think that through.
It looks like the issues is more with reporting distance than it is with geolocation. There are lat and long data in the listings so that’s all set. My problem is that my site only seems to report distance on the map view, and only under certain conditions.
I’m using the function to get the distance, and it seems to be working IF I have a location selected (which makes sense) and IF I am in map view (at at certain times, only IF I’m working in Firefox). If I’m in any other view, the distance seems to not work.
I’m going to add some information to this in a private reply so you can see what I’m talking about.
Thanks!
BrendanApril 28, 2016 at 6:22 am #1108157fifteen15studios
ParticipantThis reply is private.
April 28, 2016 at 1:09 pm #1108443Cliff
MemberThanks for all the info.
Observation: I’m guessing you filtered the Cost display to output the distance instead, since the distance is in the .list_event_schedule_cost element.
Could you please provide the code/customization you have implemented so I can take a closer look?
April 29, 2016 at 12:39 pm #1108962fifteen15studios
ParticipantHmm.. I’m not sure what you mean. I’ll add my code for the page, but the display has to do with this snippet:
<?php if ( ! empty( $post->distance ) ) { echo tribe_get_distance_with_unit( $post->distance ); } else { echo "<i>Distance Not Listed</i>"; } ?>April 29, 2016 at 12:40 pm #1108963fifteen15studios
ParticipantThis reply is private.
April 29, 2016 at 2:39 pm #1109009Cliff
MemberThanks for the additional info.
I wasn’t quite sure how to help so one of our developers helped.
This snippet may be of use to you, but if it’s not you’ll need to work things out yourself or reference our list of known customizers because it’s outside our Scope of Support / Terms.
Here it goes:
// Get the post list for the current query global $wp_query; $posts =& $wp_query->posts; // Get current coords - needs safety checks $lat = $_REQUEST['tribe-bar-geoloc-lat']; $lng = $_REQUEST['tribe-bar-geoloc-lng']; // Assign distance values $tribe_geo = Tribe__Events__Pro__Geo_Loc::instance(); $tribe_geo->assign_distance_to_posts( $posts, $lat, $lng )If you feel our plugin needs some sort of enhancement, please post it to our UserVoice page.
If you post it, feel free to link to it from here in case anyone comes across this forum thread in the future.
May 14, 2016 at 9:35 am #1114601Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Can we add geolocation to find point of event on the map?’ is closed to new replies.
