views:

113

answers:

3

I am using the Location module within Drupal 6 to tag geographical locations to blog entries. So every blog entry has a long/lat

My question is: What is the most efficient way of querying all coordinates for all blog entries of a given user?

A: 

I don't know the location modules db setup. But it probably stores it data in it's own table with a nid (node id) to reference which blog post it is for. Nodes have the uid (user id) of the user who posted it so you should be able to do a query on the locations left joining the node table.

"SELECT geo FROM {location} l LEFT JOIN {node} n ON l.nid = n.nid WHERE n.uid = %d"

The above query used with db_query is just to give an idea. I don't know the exact table layout, but something like that should work just fine.

googletorp
A: 

Location itself also integrates with Views; in addition to providing fields and filters for Locations, it also offers basic proximity filtering and sorting features.

Install Views module, add filter = blog and argument of user id. Add fields of location module that will show coordinates...

Nikit
This sounds like exactly what I need and will be helpful for other elements as well - could you be a bit more verbose on how to set up the view and reference it in PHP code? Thanks a ton!
Maik
http://www.google.ru/search?q=drupal+views+location
Nikit
A: 

Nice post thanks admin. Install Views module, add filter = blog and argument of user id. Add fields of location module that will show coordinates...

dizi izle