Which method is recommended to change lat/long into usable geolocation data

(Marc) #1

Afternoon all,

I have been having a play and look at Piwik for the past week or so and I’m impressed.

I was wondering if anyone has done or has any input on the following situation.

I tried the PECL Geolocation and its ok, as in it gives the country, but i actually have access to Lat and Long, So I got the javascript tracker to input the lat and long using the “appendToTrackingUrl” (which is a bit messy/risky from JS). But this doesn’t get used when looking at the overview map (only shows in the visitor log profile map).

So i guess my question is what would the consensus be on how to extrapolate these lat and longs on insert using a system like google geocode (e.g http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true) to get and update the location fields (state suburb etc).

Would I be better having the lat and long go to custom variables first then in a cron/report do some work to get geocode.

Or should i be able to tap into the lat and long insert (via plugin) and do the work on the fly.

Any suggestions would be appreciated.


(Marc) #2

Just found this free world cities dataset with GPS-Co-ords as well that could be handy in this process.

(Matthieu Aubry) #3

should i be able to tap into the lat and long insert (via plugin) and do the work on the fly.

If you have access to Latitude and longitude, but not city/region, then I would store lat/long.
Then in the plugin I would load the city or region from the lat long coordinates.
I guess the challenge is to find (fast) mapping from coordinates to city/region info?



I’m wanting to do something similar. Did you have any luck with making this work as a plug in?

(Terry C) #5

Yes, I’m also keen to see if/how this was achieved.

(Matthieu Aubry) #6

Piwik stores latitude and longitude and these info are available via the API @ Real Time Analytics - Analytics Platform - Matomo

What would you like to achieve?