Home › Forums › Calendar Products › Events Calendar PRO › Disable/Modify Geo Fields Exported in iCalendar Feed
- This topic has 6 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
July 29, 2015 at 7:54 am #991419
Jon Massad
ParticipantGood Morning,
We are using the iCalendar feed from our Events Calendar in a mobile application. The geo fields are causing an issue when navigation is initiated: it results in “route not found” based on the geo coordinates of the venue. If we can modify the geo coordinates to “87.2449109W 45.1126701N” vs. “87.2449109 45.1126701” or disable/hide them, this should solve our issue.
Could you please advise how me might go about making these changes?
Thank you.
July 29, 2015 at 8:36 am #991444George
ParticipantHey Jon,
This is unfortunately a tricky customization to make – while it would be possible to literally append “W” or “N” specifically to certain coordinate components, it’s hard to actually make this dynamic – in other words, to have N/S/E/W directionality be automatically applied based on those two values provided for a venue.
It’s also tricky to get this as something that’s hard-coded into the iCal feed export.
Here’s an example of the basic method for actually just appending W or N like you’ve mentioned:
$coords = tribe_get_coordinates();
$new_coords = sprintf( '%sN, %sW', $coords['lat'], $coords['lng'] );echo $new_coords;
That will take these original coordinates:
42.3470087 -71.0878904And output them (as the $new_coords variable) as this:
42.3470087N, -71.0878904WIt’s the matter of actually using these transformed coordinates that is the hard part, and is unfortunately a bit outside of the scope of the support forums here (and, also, is genuinely something tricky enough that I honestly just don’t have a solution for it at this time!).
The only thing I can think of right now that would reliably alter this coordinate output automatically, and thus hopefully alter the output when added to a generated iCal feed file, would be to apply filters to tribe_get_coordinates, something like this:
add_filter( 'tribe_get_coordinates', 'example_add_dir_to_coords' );function example_add_dir_to_coords( $output ) {
if ( ! is_array( $output ) || ! isset( $output['lng'] ) || ! isset( $output['lat'] ) ) {
return $output;
}$output['lat'] = sprintf( '%sN', $output['lat'] );
$output['lng'] = sprintf( '%sW' , $output['lng'] );return $output;
}
I’m sorry to disappoint! Hopefully some of the information I provided here is helpful in some capacity – let me know if that’s the case, or if you have any other questions or concerns.
Thank you,
GeorgeJuly 29, 2015 at 9:16 am #991465Jon Massad
ParticipantThis reply is private.
July 29, 2015 at 9:25 am #991471George
ParticipantHey Jon,
Thank you for being understanding about some of the limitations at play here – I am genuinely sorry about there not being a ton more that can be done here.
When it comes to excluding that data period, you might be able to do this by simply nullifying the output of that function, by using the same “filtering” example I provided above but just setting the output to nothing. So, for example, try adding this to your theme’s functions.php file and then try exporting from your iCal feed again:
add_filter( 'tribe_get_coordinates', 'example_nullify_coords_output' );function example_nullify_coords_output( $output ) {
if ( ! is_array( $output ) ) {
return $output;
}$output['lat'] = '';
$output['lng'] = '';return $output;
}
Let me know if this helps at all!
Thanks,
GeorgeJuly 30, 2015 at 6:59 am #991731Jon Massad
ParticipantThis reply is private.
July 31, 2015 at 1:16 pm #992335George
ParticipantHey Jon,
I appreciate your patience and your relaying of all this information back and forth, however I’m a bit confused. That support reply says this:
I have tried with regular / free one, and when I export calendar to iCal, GEO: field isn’t inside. [emphasis mine]
Then they say this:
Here is one GEO record from iCal exported from your site:
So…not sure how the Geo field is not inside the file but then they cite the Geo field inside the file.
I just tested some exported ical files and indeed, the Geo: field is not inside them.
Also, The Events Calendar itself does output coordinates in Latitude then Longitude – check out the code examples in my reply above, the one where I detail adding N and W. Those example coordinates are ones I just copied and pasted from my site while writing the example code for you, and as you can see are in order (and point to an accurate Geolocation in Boston, Massachusetts).
I cannot get that data to display in “reverse” unless I manually pull it out and flip the order…weird!
I’m really sorry about where things are this issue, and if my reply here has only added to the confusion. But the main point is this: if you need to extract event geolocation data, you can call it with the functions I demonstrated in code above.
And if it’s coming out in reverse order, then it seems like there would be other code added by the mobile app developers that causes this or something.
Thank you so much for your patience here Jon! Let me know what you think about everything I’ve written here.
Sincerely,
GeorgeAugust 15, 2015 at 7:05 am #996294Support 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 ‘Disable/Modify Geo Fields Exported in iCalendar Feed’ is closed to new replies.
