Wednesday, 28 March 2018
  18 Replies
  1.4K Visits
0
Votes
Undo
I use a self developed module on my page that checks the first upcoming events location against google for lat and lon so it can be used the get the correct map from Windy. I discovered the columns geolon and geolat in the db.. reading https://www.jevents.net/discussions/geolon-geolat it is stated to be a remnant from the past.. I like this remnant as it may allow me to store the lat lon data so I don't have to call google each page visit.

Next as I import the calendar items from remote .ics, they are all stored each scheduled cron to get the .ics calendar.
(Awsesome and works like a charm. Thanks again for the support on this)

Now I wanted to create my own plugin or maybe use the one from Nordmograph to store the coordinates.. but as I discovered each entry is (re)saved. jevents stores 0 (zero) again in both geolat and geolon.

Google not always properly returning results causes it to store true data ánd zeroes at random...

Reading this
https://www.nordmograph.com/extensions/index.php?option=com_kunena&view=topic&catid=99&id=16289&Itemid=40
Made me comment out the following lines: 32, 33, 174 and 175 in IcalEventDetail.php.

With these changes it works as expected.... but... maybe I overlooked something?

Is there a better way to avoid jevents resetting to zeroes? Or can it be taken into a next version that it doesn't save zeroes so the columns are open for other developers?

Tx
7 years ago
·
#199450
0
Votes
Undo
Hello,

Did you click find address? We usually store the lat / long.

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

7 years ago
·
#199480
0
Votes
Undo
Hi Tony, I have no "find address" button.. a 'managed locations' feature I assume..also there is no manual edit or intervention.
I am importing events from a remote ics calendar.. a plugin checks for the lat lon and stores it on save... at least that is if it can find (fast enough).. as jEvents stores zeroes at save by default, it sometimes is reset to 0 (overwriting previous lat-lon finds).

Tx,

Pieter
7 years ago
·
#199583
0
Votes
Undo
Hello,

Yes lat/lon is only saved as part of the managed locations component. No location information will be processed otherwise.

Many htanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

7 years ago
·
#199599
0
Votes
Undo
Hi Tony,

This is not about the managed locations component.

I am not using that component. I am using a plugin that processes the locations and stores these when saving an event.
The data in the lat/lon columns then is used in a module that shows these on a windy map.

Importing an remote ics calendar is triggering a save each entry. The update of that calendar is by cron job.
That way each entry save triggers the plugin. A component requires manual intervention. Which means it cannot be done unattended.

As the core jEvents (not the add on component) stores zeroes by default in lines: 32, 33, 174 and 175 of IcalEventDetail.php AND google is sometimes reluctant in returning results.. it overwrites previous stored results with zeroes again... without these defaulted zeroes in these lines it works without problems.. only overwriting when google returns something usefull.. a "too busy" message results in storing zeroes again...

Tx,

Pieter

check samples on http://cadet.nl and click some events on http://cadet.nl/nl/kalender/evenementenperjaar/2018/-
7 years ago
·
#199609
0
Votes
Undo
Hello Pieter,

This is because we don't support those columns and they are there for legacy reason. We moved to the Managed Locations Component and on importing events this managed locations component maps the location details across to the managed locations tables.

If you don't want to use managed locations, you could create your own table for the geo lat/lon and join the table in for your custom map.

Or continue changing the core files, but these changes will need applying per updated.

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

7 years ago
·
#199614
0
Votes
Undo
Hi Tony,

I see that they are legacy.
But is it needed for jEvents to store zeroes (or anything) if you don't use the Managed Locations Component?
If it just would not store anything in these columns it is fine for both legacy use as well as any other third party developer.
In short, keep the columns, don't store any values from the core jEvents in these columns. It would be an improvement.

Tx,

Pieter
7 years ago
·
#199616
0
Votes
Undo
These are database field that has been set up as

geolon float NOT NULL default 0
so we can't leave them blank. In fact when saving an event with the lines you have removed you'll still get zeros in these fields.

Don't really understand the 'too busy' issue and google. Unless your plugin is using the geolon and geolat values and asking google for an address???

Can you not add a tweak to your custom plugin to ignore entries with zero values?

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#199634
0
Votes
Undo
p.s. if its the editing of previously imported events that is the issue then we could possibly add an optional input field for geolon and geolat in the layout editor for the event edit page

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#199637
0
Votes
Undo
Hi Tony, Hi Geraint,

I think there is some misunderstanding..

The workflow is as follows:
Several users have their local outlook, thunderbird, mobile calendars tied to an iCal instance on Nextcloud Calendar
Items are created on devices are stored in this remote calendar.
remote calendar.ics is imported into jEvents using a scheduled cron hitting the update url.
the location is populated with human readable addresses from the remote calender entries.
the plugin queries google with the location to retrieve coordinates and saves in _jevents_vevdetail geolat, geolon.

This is an unattended proces. But as it happens every night. All events are saved again. Existing events are resaved.

Instead of querying google geo api for an address, the plugin is querying google for lat lon values based on the location setup in the location field.
Google sometimes is not that fast in returning results... and the threshold is 50 requests per sec.. this causes google api to sometimes return nothing. (or better a message that the threshold is met or that server is too busy).
This can be avoided by instructing the plugin to only search when there is zeroes in lat lon fields.. not when there is already something saved. Minimizing the amount of requests to google geo api. So instead of ignoring zeroes it is supposed to query the for the coordinates for entries that have zeroes in lat lon... ;)

When installing jEvents the table is setup with "geolon float NOT NULL default 0". That is ok.
But in iCalEventDetail.php it gets reset to 0 on each save of an entry. That is not necesary. If there is nothing in the location field it will store the zeroes anyway based on the default for the DB field.

Of course it would be nice to have the fields in the form of course...;)

I did check with my plugin disabled and the lines 32, 33, 174 and 175 of IcalEventDetail.php commented... it still works ok.. zeroes by default. When plugin enabled and no location set, still default zeroes... at my setup it doesn't break anything.

Tx,

Pieter
7 years ago
·
#199925
0
Votes
Undo
I have coded up a modification that allows you to include geolon and geolat in the edit event custom layout.

If you want to try it - please install JEvents from here

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#200067
0
Votes
Undo
Sorry wasn't close to my development machine last few days..
question: can I just overwrite the files from the com_jevents.zip into my test setup?
7 years ago
·
#200070
0
Votes
Undo
Yes, if you install it via the Joomla! Installer it will update your site with that package.

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

7 years ago
·
#200145
0
Votes
Undo
Great thanks.
Did that and that works ok.. you may need to check the one "lattitude label" it shows twice in the value list.. actual value in the editor is OK though..

This is manual editing only.

When I do schedule imports from an ICS file and have the plugin query google for the lat lon on the addresses in the ics, it still writes zeroes if google doesn't return any... (slow, busy, max queries) I still had to comment out the lines to make it work on automated imports...

I need to rewrite my plugin not to fire when manually edited.. :o

Tx,

Pieter
7 years ago
·
#200175
0
Votes
Undo
pieter

For the manually edited just check if there is a user id when running, if it is 0 it's not a logged in user running it.

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

7 years ago
·
#200191
0
Votes
Undo
That is a good one.. Thanks!

A thought about the default zeroes in IcalEventDetail.php?
When I don't have values (which I don't as it is a scheduled import from url ics file)
It starts storing zeroes first then the plugin kicks in (with the id check :) ).. When G returns nothing it sticks to zeroes randomly..
6 years ago
·
#208616
0
Votes
Undo
Hi Tony, It has been a while...

Google even worsened its policy on maps and the lookups... now they need billing enabled and still there is no useable lookup possible for more than approx 10 addresses in a minute.... so I rewrote the entire plugin... using geocode.xyz.

Also paid but with a far better policy and performance... of course that is relative.. some may think differently...
But if one can cache the results you can do for 20 dollars a year......

Still I am sort of stuck with the zeroes..

The user check is a good one but actually does not work as supposed when using update button or anon url link from the back end of joomla...(since you then are a logged in user not being 0) Now my thought was to check it against the task...

Still best working option is to comment the lines out.
The install of jEvents does add the tables as expected for legacy use. So they are not missing and manually updating by filing the lat lon in the inputfields still works as expected...

(The real issue here actually is that in the iCal file I process there are no lat en lon details set. Therefore I add them in the import process.. but since jEvents does expect them to be there it sets them to zero first. While on update, only new or altered entries should be processed. There are more apps with ical support that do not parse the lat lon....) there fore the less than mandatory fields may be a problem... some other apps I know miss out on the "category". Meaning that one in these cases will be zeroed or defaulted too.

The event handler in the plugin now uses "onAfterSaveEvent($event)" maybe there is a better event handler to use? As it only needs to really write the ical fields that are actually in the ical.... not the ones missing...

Not really a long story short... sorry ;)
6 years ago
·
#208620
0
Votes
Undo
Curios... why you don't use the Managed Locations addon? Is it because you cannot justify the membership?

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

6 years ago
·
#208649
0
Votes
Undo
Yes sorry for that..
One of the things.. since I am not paid to do and maintain this site....with the organisation, there is no budget for this. I already spent some from my own pocket for a geocode.xyz account...
Second is that I am moving away from Google maps because of their policy changes. Now with a free tier... but what is next?
With my own plugin i am also free to change to another API if I want to.

On the technical side..
Also I don't see why Managed Locations would help me, since the remote ical import is done in IcalEventDetail.php, it will not make a difference... each import will overwrite thus first set the lat en lon to zero... then it will search for the actual lat/lon afterwards... this will still add up to the amount of lookups... And it is a lot of ballast for just the need of geocoding... I don't need all the features,

The description indeed states:
Match locations in Events import and create new locations on events import when no matching available.
But since not all ical/ics sources provide a LAT / LON in the exports, it will result in lookups.

I now already lost a third of my initial buy of credits by testing my changes.... (stupid me, I should have created an error_log only plugin to do so....).......
  • Page :
  • 1
There are no replies made for this post yet.

Members Area

Show your support

Unlike many Joomla calendars we do not charge to download JEvents - please show your support for this project by becoming a member of the JEvents Club Club members get access to early releases, exclusive member support forums, and Silver and Gold members can use many exciting JEvents addons

Your membership will ensure that JEvents continues to be the best events calendar for Joomla.