Jump to content

Should I store lat/lng in their own table?


Andy-H

Recommended Posts

I have a database which receives location data from tracking units, I'm not sure wither I should store lat/long pairs in their own table, or along with the incoming data, I could argue that lat/lng's belong to a location, and therefore belong with a location, but I can also argue that lat/lngs are constants, whereas data that could be attached to them are not, I.e. speed limits, road names.

 

 

At the same time, bearing, altitude etc are constant for the given location, but if I want to attach a reverse geocode cache result to a location based on radius the only option I can come up with is adding a default NULL (FK) id to the locations table to associate locations to geocode.

 

 

What's the best way to go?

 

 

Cheers

Link to comment
Share on other sites

I have attached my database design so far, I need to be able to

 

- Control which trackers a user can view/update (users_trackers)
- Control which RFID tags belong to users (users_RFID) 
- Store location data from GPRS/SMS units (trackers.locations) 
- Filter weather a location was an alert (i.e. high speed alert, alarm) (trackers.locations.alerts [left join]) 
- Optionally store data from unit inputs (trackers.locations.data (how can I get multiple rows of data??) 
- Optionally attach an RFID to a journey (trackers.journeys[RFID] = NULL)  
- Query for custom user defined locations with in a radius of locations, fall-back to reverse geocode (users.locations[lat/lon] - trackers.locations[lat/lon] (reverse geocode table not added yet)

 

Can anyone think of a better way of doing this?

 

 

Also, is it possible to LEFT JOIN a table (users.locations) then fallback to another LEFT JOIN if that returns null (reverse geocode)

 

 

Thanks for any help.

post-67458-13482403231539_thumb.png

Link to comment
Share on other sites

Cheers. bookmarked it, are you in the tracking industry?

 

Hi Andy,

No, not in tracking industry. Use Gsak and a UPSr unit to geocache. And at one time, tied it into my Ham Radio for tracking my vehicle and sending weather info.  My daughter is a hiker and uses it with her GPSr and with something called spot (i think) to upload her location and print it to a map on the internet, so we can track her.

 

PS. I don't think you attached your database design.

Link to comment
Share on other sites

Oh cool, I work for a company called Phantom Ltd, were building a fleet tracking system so users can login and see live updates of where their fleet vehicles are in real time. I don't really know much about tracking, I'm just a programmer :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.