Advertisement:

Author Topic: Looking for help to integrate GOOGLE MAPS+SMF **Demo available  (Read 61262 times)

Offline PhatTyres

  • Semi-Newbie
  • *
  • Posts: 71
  • Gender: Male
    • Clip'd In Cycling Community
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #120 on: December 19, 2005, 08:44:32 PM »
Hey Ride...
I like your integration...anything you can share with TLM, to get the avatars, additional Pins, members, and stuff you have on your maps.
And your members, do they place pins or call a zip code for general location.

I would like to add locations for trail heads, and an eventual trail database with trail descriptions, comments, maps, and Google Earth interation.
« Last Edit: December 19, 2005, 08:50:05 PM by PhatTyres »
OTB and Runnin Down The Hill

SMF 1.0.5  MKp1.0                                Clip'd In Cycling Community

Offline TLM

  • Full Member
  • ***
  • Posts: 420
  • Gender: Male
    • MindlessTux
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #121 on: December 19, 2005, 09:04:49 PM »
Hey Ride...
I like your integration...anything you can share with TLM, to get the avatars, additional Pins, members, and stuff you have on your maps.
And your members, do they place pins or call a zip code for general location.
Your saying I dont know how to add avatar, and things? :P  I just pushed the mod out early to appese people that kept posting wanting it.  Avatars and some permissions will be done tonight.

I would like to add locations for trail heads, and an eventual trail database with trail descriptions, comments, maps, and Google Earth interation.
Sounds like a whole new map idea there, but I am guessing that you would like it to be merged with the member map?

Offline HoTmetal

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,952
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #122 on: December 19, 2005, 09:09:40 PM »
I was thinking of a way to limit pins, and still have this mod usefull. Is there a way pull x number of users closest to location x. For example at Ride's site,  it could show the 1st 150 members closest to Bear Mountain. Of course the 150 is a number set in the admin panel, it could be more or less. Then the user could set location X based on their needs. I'm not sure if this is possible, & or the best way to go about it....
 Just a thought

Good work thus far.

Offline PhatTyres

  • Semi-Newbie
  • *
  • Posts: 71
  • Gender: Male
    • Clip'd In Cycling Community
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #123 on: December 19, 2005, 09:14:12 PM »
Quote
Your saying I dont know how to add avatar, and things? Tongue  I just pushed the mod out early to appese people that kept posting wanting it.  Avatars and some permissions will be done tonight.

No...No...No... not doubting your skills I just liked his integration...and wondered if Ride could help out.

I appreciate your Push in the last few Days.
I understand that you wanted to put up what was already done and more is to come.

Quote
Sounds like a whole new map idea there, but I am guessing that you would like it to be merged with the member map?

Yes I would like to merge data with the Member Map.

I am playing with the features but It is slow work for me...I am an absolute php,sql idiot.
OTB and Runnin Down The Hill

SMF 1.0.5  MKp1.0                                Clip'd In Cycling Community

Offline TLM

  • Full Member
  • ***
  • Posts: 420
  • Gender: Male
    • MindlessTux
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #124 on: December 19, 2005, 09:15:18 PM »
I was thinking of a way to limit pins, and still have this mod usefull. Is there a way pull x number of users closest to location x. For example at Ride's site,  it could show the 1st 150 members closest to Bear Mountain. Of course the 150 is a number set in the admin panel, it could be more or less. Then the user could set location X based on their needs. I'm not sure if this is possible, & or the best way to go about it....
 Just a thought

Good work thus far.
Well if you wanna go about that way, X number closest to Y User.  This will work but I dont know how well/what kind of performance hit this will cause.  Use the good old distance formula, just think lat and long of both users is there x and y cordnats, then it just becomes sqrt((x1-x2)^2 + (y1-y2)^2) (if memory serves me right on the formula), and take your answers, make an array, sort the array on that number and take the first X or so, then from there cross back to the users table with the ids, vola.

Quote
Your saying I dont know how to add avatar, and things? :P  I just pushed the mod out early to appese people that kept posting wanting it.  Avatars and some permissions will be done tonight.

No...No...No... not doubting your skills I just liked his integration...and wondered if Ride could help out.

I appreciate your Push in the last few Days.
I understand that you wanted to put up what was already done and more is to come.
Well what he has done, I dont think I could use much more of, I might be "stealing" his member listing of users.  By "stealing" I mean looking at the code and seeing how he went about the list linking into the map causing the popup.  From a breif glance it looks fairly simple.

Quote
Sounds like a whole new map idea there, but I am guessing that you would like it to be merged with the member map?

Yes I would like to merge data with the Member Map.

I am playing with the features but It is slow work for me...I am an absolute php,sql idiot.

I might much later on down the way, include perhaps a way for someone to include a xml file or something with points and paths...  dunno yet about that, talk to me much later on about this. :)
« Last Edit: December 19, 2005, 09:20:08 PM by TLM »

Offline HoTmetal

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,952
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #125 on: December 19, 2005, 09:19:52 PM »
I was thinking of a way to limit pins, and still have this mod usefull. Is there a way pull x number of users closest to location x. For example at Ride's site,  it could show the 1st 150 members closest to Bear Mountain. Of course the 150 is a number set in the admin panel, it could be more or less. Then the user could set location X based on their needs. I'm not sure if this is possible, & or the best way to go about it....
 Just a thought

Good work thus far.
Well if you wanna go about that way, X number closest to Y User.  This will work but I dont know how well/what kind of performance hit this will cause.  Use the good old distance formula, just think lat and long of both users is there x and y cordnats, then it just becomes sqrt((x1-x2)^2 + (y1-y2)^2) (if memory serves me right on the formula), and take your answers, make an array, sort the array on that number and take the first X or so, then from there cross back to the users table with the ids, vola.

Ok, so it would work, thats good news, but is this a good way to handle things? I know I could use this, but there's no way I could code this... I'm lost after print "hello!"; lol I'm learning. I look  through the code & see how things work, but making things, thats another story.

Offline TLM

  • Full Member
  • ***
  • Posts: 420
  • Gender: Male
    • MindlessTux
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #126 on: December 19, 2005, 09:21:27 PM »
Ok, so it would work, thats good news, but is this a good way to handle things? I know I could use this, but there's no way I could code this... I'm lost after print "hello!"; lol I'm learning. I look  through the code & see how things work, but making things, thats another story.

Let me push out 0.50 of my mod then, I shall see what time it is, and if theres time, I shall write you some psudo code that might help you along the way.

Offline HoTmetal

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,952
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #127 on: December 19, 2005, 09:33:10 PM »
Ok, so it would work, thats good news, but is this a good way to handle things? I know I could use this, but there's no way I could code this... I'm lost after print "hello!"; lol I'm learning. I look  through the code & see how things work, but making things, thats another story.

Let me push out 0.50 of my mod then, I shall see what time it is, and if theres time, I shall write you some psudo code that might help you along the way.

Sweet !! Aaahhh psudo code, I might be able to put it to work.(depends on how much beer I have before hand) Baby steps.... I like it ....:D (thanks) But I don't want to waste your time, unless this could be a usfull thing for other people. I'm just happy that someone took the time to get this far. I will D/L your new ver. when it gets approved.... (Unlike last time I tried to D/L before hand :D) thanks again TLM ~~~

Offline TLM

  • Full Member
  • ***
  • Posts: 420
  • Gender: Male
    • MindlessTux
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #128 on: December 19, 2005, 09:37:26 PM »
Well, it should be approved right now, just 0.50 is not done so its not up. :P

Looking at the avatar thing, oh boy thats gonna be fun, how did you go about doing the avatars yourself there rickc?  Did you query the attachments and members table hunting down avatars? Or is there some unknown function in smf I dont know about that pulls the members avatar?
« Last Edit: December 19, 2005, 09:39:37 PM by TLM »

Offline HoTmetal

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,952
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #129 on: December 19, 2005, 09:43:01 PM »
Well, it should be approved right now, just 0.50 is not done so its not up. :P

Looking at the avatar thing, oh boy thats gonna be fun, how did you go about doing the avatars yourself there rickc?  Did you query the attachments and members table hunting down avatars? Or is there some unknown function in smf I dont know about that pulls the members avatar?
Actually. forsakenlad did my joomla integration.
Um, I could look at the code, but I'm not too sure on how he did it... I'll post the code here though , when I find it...

Offline TLM

  • Full Member
  • ***
  • Posts: 420
  • Gender: Male
    • MindlessTux
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #130 on: December 19, 2005, 10:02:40 PM »
Thats ok, I think I found the function I am was looking for, now the trick is to understand the output, and if it works the way I think it does, it will further optmize part of my mod. :)

Offline TLM

  • Full Member
  • ***
  • Posts: 420
  • Gender: Male
    • MindlessTux
Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
« Reply #131 on: December 20, 2005, 01:18:50 AM »
Well here is the code I used to pull the member data of who have lat/long, which also allowed me to pull avtar info and other nice things real easily if your interested.  It was a devil of a time tring to search on loadMemberData() and loadMemberContext() here at SMF, so I though I would throw this up incase anyone else needs it...

Code: [Select]
global $db_prefix, $memberContext;

$query = "SELECT *
FROM {$db_prefix}members
WHERE latitude IS NOT NULL AND longitude IS NOT NULL";
$request = db_query($query, __FILE__, __LINE__);

//Ok this is block of code takes care of the entire load all member data into $memberContext on per # basis
$temp = array();
while ($row = mysql_fetch_array($request, MYSQL_ASSOC))
   $temp[] = $row['ID_MEMBER'];
loadMemberData($temp);
foreach ($temp as $v)
   loadMemberContext($v);

print_r($memberContext);

With the above code here is your psudo/php code now... you might have to clean it up into proper php...
Code: [Select]
global $db_prefix, $memberContext;

//What point we working from to the users?
$point = array()
$point['latitude'] = 0;
$point['longitude'] = 0;

//Lets get the users...
$query = "SELECT *
FROM {$db_prefix}members
WHERE latitude IS NOT NULL AND longitude IS NOT NULL";
$request = db_query($query, __FILE__, __LINE__);

$temp = array();
while ($row = mysql_fetch_array($request, MYSQL_ASSOC))
   $temp[] = $row['ID_MEMBER'];
loadMemberData($temp);
foreach ($temp as $v)
   loadMemberContext($v);

//Calculation time...
$temp = array();
foreach ($memberContext as $member)
  $temp[$member['id']] = sqrt(pow(($point['latitude'] - $member['googleMap']['latitude']), 2) + pow(($point['longitude'] - $member['googleMap']['longitude']), 2));

natsort($temp);
//At this point we should now have a sorted list lowest to highest, along with member ids by $temp['id']
print_r($temp);

The reason I used $member['googleMap']['latitude/longitude'] was how I constructed it in my mod, so you can look at my mod and figure out how I got that, I do belive the above should do you.
« Last Edit: December 20, 2005, 01:30:43 AM by TLM »