Deferred reverse geo coding upon record save/update
7 views
Skip to first unread message
Subodh Nijsure
unread,
Apr 17, 2014, 7:19:25 PM4/17/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
I have application where mobile devices are collecting data from
sensors, and along with sensor reading they also save gps co-ordinates
where the sensor data is taken. This is uploaded to web server using
REST interface on django platform.
But I am trying to figure out how do I reverse geo decode those
lat/lang numbers to actual address using google reverse geo-coder
APIs. I know I could do this in save method but that would make save
operation slower. Is there some way I can queue these operations
within django implementation so the save can proceed but queue up a
job that will reverse geo-decode lat/long and update a record.
Say:
My REST api creates a new record in table sensordata, with lat, long
of (10.1, -120.202) what I want to happen is new record for sensordata
say unique id 1234 gets created. At the same time job is queued
somewhere that will update record #1234 that will reverse geo-decode
10.1,-120.202 to the street address.
-Subodh
-Subodh
Ramón Carrillo
unread,
Apr 17, 2014, 11:18:42 PM4/17/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi Subodh,
I would use use the same model as a queue.
Add a address field to the sensordata model, make it nullable
(null=True). Then write a custom django-admin command [0] that gets
all the records in sensordata with null address, make the request to
the geodecoder and save the result in the address field.
Let's say you name your command 'geodecode':
$ manage.py geodecode
will fill the address for all the sensordata records with null address.
If you're in a Unix environment, you could use cron [1] to run this
command every certain time.