Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Ride on August 18, 2005, 01:49:21 PM

Title: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on August 18, 2005, 01:49:21 PM
** EDIT 11/9/05   Almost all done.  Check it out on page 6 of this thread here: http://www.simplemachines.org/community/index.php?topic=46141.msg391988#msg391988



First off, for those that haven't seen it yet -----------> http://maps.google.com

Google maps has an api that allows developers to integrate with their own site/database/whatever    see -----> http://www.google.com/apis/maps/

I've made myself a simple little map (this is just for testing right now, eventually will have snow reports in info box).  It shows where local ski resorts are in socal.  When you click on a marker, you'll get info.  -------> http://www.ridesocal.com/map.html  (take a look at the source code to get an idea of how this simple example works)


Now what I'd like to do is integrate google maps with the smf.  I'd like to put a marker for every member on the map.  When the marker is clicked, it will show basic member info like avatar, membergroup, posts, etc.  To see an example of something similar, see the HotorNot+Google Maps integration here ---> http://hotmaps.frozenbear.com/


Google maps needs long/lat coordinates to set the market.  Of course it'd be silly to have members enter in their gps cords.  I think the best solution would be for users to enter in their zip code into the already existing location field in the profile.  I'm in the US so not sure how it works elsewhere for zip code type codes.  The zip code would then have to be queried to get the coresponding lat/lon cords and that info entered into the member's table in the database.  Free lists with zip codes and their lat/lon are available in a variety of places like here -----> *can't find the link right now
Also, I believe there are sites that allow you to query them with a zip and they return the coordinates.

An xml file could be generated with the member cords, info, etc. and then placed on the map with a marker.  How cool would this be?


I have experience with php, mysql, etc. but mostly from reverse engineering.  I see how bits and pieces work and am able to modify how things work w/o really know what makes them work.  This is where I turn to all the great people here.  As far as I know, no other forum software has done this yet.  It'd be great for smf to be the first!  Let's all put our heads together and make this happen!  Who's in?  ;)


Here are some google maps related links that may be helpful
http://www.map-server.com/googlemaps/wholocations2.php
http://dev.system7designs.com/
http://mapki.com/index.php?title=Knowledge_Base#Tutorials_and_HowTo.27s
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Slack on August 18, 2005, 06:43:08 PM
Royce I think this is a great idea and have been looking for something similar as I cannot get Member Map to run on my site anymore and  my users loved it.   I think in the long run an independent Map that reads the database is better than one that is an integrated Mod.  Not sure how much I can help -- I'm not reqally a prgrammer and have limited time - but I'll do what investiigating I can.

mapbuilder.net is very close the Location Mod (or SMF Member Map), you can place a pin on a shared Map by clciking a location, - but there seems to be a performance problem in showing more than 150 pins  -- have you checked this site out? 

Cheers,
slack
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 18, 2005, 07:40:10 PM
Quote from: Slack on August 18, 2005, 06:43:08 PM
Royce I think this is a great idea and have been looking for something similar as I cannot get Member Map to run on my site anymore and  my users loved it.   I think in the long run an independent Map that reads the database is better than one that is an integrated Mod.  Not sure how much I can help -- I'm not reqally a prgrammer and have limited time - but I'll do what investiigating I can.

mapbuilder.net is very close the Location Mod (or SMF Member Map), you can place a pin on a shared Map by clciking a location, - but there seems to be a performance problem in showing more than 150 pins  -- have you checked this site out? 

Cheers,
slack

Yeah, I haven't used their shared maps but I've used the service to use my own maps for my site.  I agree that it doesn't really have to be a mod, just able to read the db.  You would have to have at least a zip code in the db though.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 23, 2005, 03:33:41 PM
I'm curious to know what [unknown] thinks about this.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 24, 2005, 09:20:15 PM
You there unknown?   :P
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: [Unknown] on August 25, 2005, 01:48:43 AM
Quote from: Ride on August 18, 2005, 01:49:21 PM
Google maps has an api that allows developers to integrate with their own site/database/whatever    see -----> http://www.google.com/apis/maps/

That's pretty cool.  If I had like... three of me, one of them might have time to play with that.

-[Unknown]
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 25, 2005, 02:16:27 AM
Quote from: [Unknown] on August 25, 2005, 01:48:43 AM
Quote from: Ride on August 18, 2005, 01:49:21 PM
Google maps has an api that allows developers to integrate with their own site/database/whatever    see -----> http://www.google.com/apis/maps/

That's pretty cool.  If I had like... three of me, one of them might have time to play with that.

-[Unknown]

Well, I'll work on cloning you soon.  Until then, maybe you can check back here for questions we may have?  I have an idea how to do it and might have some simple code questions.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 25, 2005, 09:13:59 PM
alright need just a little help.  I have in the database a list of zip codes and their lon/lat like this:

zip      |lat           | long          |

92835|33.90320|-117.91200 |


I changed the "location" field already in smf to "zip" and shortened the input box to only allow 5 characters.

What would be the best way to match the member's inputted zip code with the zip code in the db that has the lat/lon and put it into the smf_members table?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: [Unknown] on August 26, 2005, 12:12:12 AM
Well, if you're getting just one member, with a query after knowing their zip:

SELECT lat, long
FROM geographic
WHERE zip = '12345'
LIMIT 1;

For multiple members, based on ID:

SELECT mem.ID_MEMBER, g.lat, g.long
FROM geographic AS g, smf_members AS mem
WHERE g.zip = mem.location;

Or similar.

-[Unknown]
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 26, 2005, 12:51:10 AM
ok, that helps indeed.  I'm thinking the best way to do this is when they update their profile with the zip.  Would I just need to edit profile.template.php or profile.php?  (I'm digging around right now but thought I'd just ask anyways).

Would you mind posting the code as it would need to be inside profile.php or template.profile.php?  Thanks [unknown], I think I may be able to get this going tonight!!  (or today depending on where you are)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 26, 2005, 05:13:33 AM
I can't figure out where I put this   :(    Can anyone chime in?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 26, 2005, 05:34:09 AM
This has got me all excited again :)

Here is a link to a page with a zip file of UK postcodes with  long/lat conversion..

http://www.easypeasy.com/guides/article.php?id=64

It uses the first half of the post code - so probably good for member privacy too.

US Version from 2001
http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 26, 2005, 01:19:22 PM
I've already got those files for the us.  After I get it working I'll work on the uk too.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 28, 2005, 09:21:04 PM
The US zips as far as coordinates go are waaaaaay off.  The city matches the zip though so that's good.  I can add that to my other file so I have accurate city and gps cords for the zip.  Thanks!

So [unknown], can you answer my previous question?  I'm kind of stuck right now.  Also, once I have the cords in the member's profile, how would I out put every member's cords into a page (if the cords exist)?  Basically the outputed page will look like this:

javacript stuff bla bla bla var= $lat
bla blajbkalb albj= $lon
kadsjf sdf membername= $membername

javacript stuff bla bla bla var= $lat
bla blajbkalb albj= $lon
kadsjf sdf membername= $membername

javacript stuff bla bla bla var= $lat
bla blajbkalb albj= $lon
kadsjf sdf membername= $membername


Gracias!
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 30, 2005, 07:33:22 AM
This might help...

http://www.map-server.com/googlemaps/tutorial_writing.html

Obviously you will need to rip the post/zip code from the users profile.

Good luck

Tony

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 30, 2005, 10:11:59 AM
Hey Ride,

Ive started on a uk version - in fact very nearly there!  - although Im now wondering if its viable on large forums.

Tony

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 30, 2005, 05:00:41 PM
Nearly Nailed... I've got it working inside SMF's templating system... well its displaying a map - no pins... but thts where I need help :)

I have a table called geographic....

`id` int(11) NOT NULL auto_increment,
  `lat` decimal(10,6) NOT NULL default '0.000000',
  `lon` decimal(10,6) NOT NULL default '0.000000',
  `zip` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`)

id   lat                   lon                  zip
1    57.135000      -2.117000      AB10
2    57.101000      -2.111000      AB12

And So on.....

In my profile.template.php I have added the following....

', !empty($context['member']['options']['profile_post_code']) ? '</tr><tr>
<td><b>Zip: </b></td>
<td>' . $context['member']['options']['profile_post_code'] . '</td>' : '', '


From my understanding the profile_post_code is in the themes table.... hmmm thats where I am stuck.

My sql knowledge is not very good - but Im trying :)

Because I am doing a loop through the DB (which seems very slow - 25 seconds per page refresh) I chose to use your sql statement above to play with...


SELECT mem.ID_MEMBER, g.lat, g.lon
FROM geographic AS g, members AS mem
WHERE g.zip = mem.location;


From what I understand from the statement above - is that its pulling the location field off the profile(members table)

How can I redirect this to the profile_post_code from the themes table?

As I have thousands of members - would it not make sense to add this one field to the members table instead of the themes table? and if so - how do I do it?

Thanks for any help anyone can offer.

Tony,







Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 30, 2005, 06:09:16 PM
I guess you made a custom field for zip?  I just changed the "location" field to "zip" so that it stayed in the members table.  Maybe do that?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 30, 2005, 06:13:43 PM
I thought about that - perhaps thats the best way to handle it on a single install - although my members have used it for location name so I have thousands of entries to remove :(

When(and if we get it working) this becomes a mod - it will need to have a solution that doesnt interfere with location though :(

Im still thinking that it needs to be an additional field on the members table.


Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 30, 2005, 06:20:28 PM
Quote from: Tony on August 30, 2005, 06:13:43 PM
I thought about that - perhaps thats the best way to handle it on a single install - although my members have used it for location name so I have thousands of entries to remove :(

When(and if we get it working) this becomes a mod - it will need to have a solution that doesnt interfere with location though :(

Im still thinking that it needs to be an additional field on the members table.




Does this topic help?  Funny enough, it's about adding a zipcode field.

http://www.simplemachines.org/community/index.php?topic=37311.0
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 30, 2005, 06:24:05 PM
It sounds like you are stuck where I am.  I also have a table with zip, lon and lat data.  We would combine our 2 lists so that both us and uk are covered if this ever gets released as a mod.  I've also got city data so that when they enter the zip code, it will display in their profile what city goes with the zip code.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 30, 2005, 06:27:46 PM
Yeah - Sure would be great to merge the two.

I haven't got city data - but the UK doesnt have that many ;D so not too bothered :)

The link above might help with this :)




Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on August 31, 2005, 12:02:51 AM
Where you able to make any progress tony?  I didn't get a chance to work on it today.   :-\
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on August 31, 2005, 03:13:44 AM
No.... I  started - but im in UK (GMT timezone) so had to go to bed :)

Perhaps if I get a chance  I'll have a go today - and see if we can get the maps plotted :)

I have some thoughts though.

1) Should it work like the 'Location' mod? - is it viable in terms of query length to scan through all members and then build the googlemap?

2) Would it be better to have a link in the members profile that plotted where they are on a google map and calculated the distance between both members? Im not sure how to calculate distance based on long/lat - do you know?

3) Would both of the above be an option?

4)  Does the google key need to be a page in the admin center? I think it does.

I dont have time to do all of this - and think that rather than develop two versions - perhaps we would be better off working on the same mod - thats if your ok with that?

Let me know your thoughts :)

Tony







Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 02, 2005, 01:40:47 AM
I have had zero time to work on this in the last week.  :(   Anyone else interested in lending their brain power?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: kadhumia_flo on September 02, 2005, 10:15:55 AM
GOOGLE MAPS SUX CAMPARED TO GOOGLE EARTH
DONT USE GOOGLE EARTH.. ITS ONLY FOR ME TO ENJOY :P
;D ;D ;D
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 02, 2005, 12:42:31 PM
Quote from: kadhumia_flo on September 02, 2005, 10:15:55 AM
GOOGLE MAPS SUX CAMPARED TO GOOGLE EARTH
DONT USE GOOGLE EARTH.. ITS ONLY FOR ME TO ENJOY :P
;D ;D ;D

[sarcasm]Thanks for contributing to our discussion[/sarcasm]
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: kadhumia_flo on September 02, 2005, 01:25:43 PM
ok no problem
but its really good
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 04, 2005, 04:20:51 PM
Quote from: Ride on September 02, 2005, 01:40:47 AM
I have had zero time to work on this in the last week.  :(   Anyone else interested in lending their brain power?

I havent had any time at all.

I see someone else has also started a mod - however I do have concerns over how intensive it would be to search the entire members table each time the maps displayed :(

I'm beggining to think that this needs to be rewritten aother way.

Hmmm
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 04, 2005, 10:06:16 PM
Quote from: Tony on September 04, 2005, 04:20:51 PM
Quote from: Ride on September 02, 2005, 01:40:47 AM
I have had zero time to work on this in the last week.  :(   Anyone else interested in lending their brain power?

I havent had any time at all.

I see someone else has also started a mod - however I do have concerns over how intensive it would be to search the entire members table each time the maps displayed :(

I'm beggining to think that this needs to be rewritten aother way.

Hmmm

I think a cron or some other way where it is written every day would be the best route.  The cron could write a static xml file for the map to read from.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 05, 2005, 07:35:49 AM
Sounds like a good idea :)

Might run into problems with the file ownership - if apache/php  is creating it though.

Might look into it later today :)

Tony,
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 05, 2005, 08:10:46 PM
Ah, there is an idea I did not think about, making a static xml file, but currently dont see any performance issues with generating a map off the member data table. 

But looking at what you guys have posted, your using zip codes for some reason, what for?
Im blind, but why not just do like the old member map mod did in YaBB SE, where the user places a pin on the map and you end up just storing the lat and long cordnates that come from the google API code.  Thats what I have so far on my version of this.  Also by doing that that allows the user to be as precise as they want, down to the last street or as far off as just pointing the town.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 05, 2005, 08:15:22 PM
Hi,

I need postcodes(zip  codes) so members can calculate distance between each other etc...  my members would not want the fuss of working out long/lat at all.

Placing a pin would not be accurate enough.

Would your map suffer with a lookup of around 10,000 users? do you know how long it would take to draw?

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 05, 2005, 08:17:34 PM
If a pin is that acurrate then perhaps it might be an alternative?

Hmm... am off to bed now - but will post again tomorrow :)


*edit - Thinking about this - zip code would be needed if you wanted to search for members in your area?

Perhaps doing a lookup for just your postcode and surroundiong post codes would be smarter than drawing the whole memberbase on a map?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 05, 2005, 08:23:59 PM
Well so far my map does not have to many pins but seems to be ok.  Although I do see a problem in time for the page to be sent coming soon once there are enough pins.  So right now I am looking into storing the data in some method, more than likly an xml file.  The API has a method of importing a XML file and doing things that way but I have not put much time into it due to a person on my forum mentioned using google earth as well.  Which I have put some time into as well.  Whats interesting is the google maps point lat/long data is the same used by google earth so that can be interchangable.

http://www.teamplayfirst.com/forums/index.php?action=membermap
http://www.teamplayfirst.com/forums/index.php?action=.kml - Use google earth as a network link

Also I remember reading somewhere the next revision of the API will have geocoding built in to it if I am not mistaken.

So far my version of this mod has an enable/disable check box, the API key, and gender coloring on the pins, got bubbles/popup with some info, not all I want in there right now.

Unfortantly I started wrong and crossed my lat and long in data storage so I am fixing it now.

A recent little bug I also noted with my idea of placing a pin how the user chooses works but if you zoom out far enough the map repeats and you place a pin on the repeat it causes the pin to be logged but not shown for some reason.  Yet it seems to use the correct lat/long for the placement.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Dannii on September 05, 2005, 09:00:43 PM
Google maps only stores american "zip codes" So it wouldn't be all that nice to non americans would it? Pins are the way to go.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Slack on September 05, 2005, 09:19:48 PM
Quotehttp://www.teamplayfirst.com/forums/index.php?action=membermap

TLM, this looks great - is your version available for download? -- or will it be available?

Tnx,
slack
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 05, 2005, 09:26:54 PM
A few details have to be ironed out first, followed a stress test, and for me to learn how to package it before the public will get a copy of mine.  Right now thats only 54 pins and I know some forums might have somewhere near a few hundred at least so I need to test that as well.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 06, 2005, 05:57:18 AM
This is looking great - you have done well :)

I'm looking forward to playing with it on a large scale :)

Tony
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 06, 2005, 10:28:10 AM
I just tested it with 10k users, all of which were randomly generated numbers... and well the test results are not as good as I hoped...

action=membermap in the browser downloads a 7.1 meg file on the default theme, 90% (guessing) is the google java script.  Which just causes the browser to hard lock nicely.  So definatly gonna need to look into a better way to show 10k pins.

The file for google earth is about 3.9 meg, (test server differs from my live site) which is an odd decrease but after all it is just xml so not sure.


-rw-r--r--   1 root   root   3.9M Sep  6 10:26 googleEarth.php
-rw-r--r--   1 root   root   7.1M Sep  6 10:18 index.php?action=membermap


But if you want a good laugh, check out the attachment.  I just picked lat 0-90 and long 0-90 as the random feild and well, thats it it seems.

Back to cutting off about 1k pins at a time to find the sweet spot of number of users...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 06, 2005, 10:50:26 AM
LOL

Hmmm... ok on a serious note.... perhaps it needs to be done slightly differently.
Maybe showing 10k at a time is overkill.

Is it possible to add to the map dynamically? by that I mean just zooming in and drawing the pins for the visible area? much like videogames do?


Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 06, 2005, 10:52:50 AM
I dunno yet, might be worth looking into... btw the max number I would ever do at one time would probally be 1k users.  Takes FF about a min and a half to load it, but it load the page.  As for google earth, it can take the whole load of 10k but its not pretty, so would say 2-5k at end user descression...


-rw-r--r--   1 root   root   7.1M Sep  6 10:45 10kUsers
-rw-r--r--   1 root   root   737K Sep  6 10:50 1kUsers
-rw-r--r--   1 root   root   1.5M Sep  6 10:50 2kUsers
-rw-r--r--   1 root   root   2.2M Sep  6 10:49 3kUsers
-rw-r--r--   1 root   root   2.9M Sep  6 10:48 4kUsers
-rw-r--r--   1 root   root   3.6M Sep  6 10:48 5kUsers
-rw-r--r--   1 root   root   4.3M Sep  6 10:47 6kUsers
-rw-r--r--   1 root   root   5.0M Sep  6 10:47 7kUsers
-rw-r--r--   1 root   root   5.7M Sep  6 10:47 8kUsers
-rw-r--r--   1 root   root   6.4M Sep  6 10:46 9kUsers
-rw-r--r--   1 root   root   4.0M Sep  6 10:45 GE10kUsers
-rw-r--r--   1 root   root   402K Sep  6 10:50 GE1kUsers
-rw-r--r--   1 root   root   802K Sep  6 10:50 GE2kUsers
-rw-r--r--   1 root   root   1.2M Sep  6 10:49 GE3kUsers
-rw-r--r--   1 root   root   1.6M Sep  6 10:48 GE4kUsers
-rw-r--r--   1 root   root   2.0M Sep  6 10:48 GE5kUsers
-rw-r--r--   1 root   root   2.4M Sep  6 10:47 GE6kUsers
-rw-r--r--   1 root   root   2.8M Sep  6 10:47 GE7kUsers
-rw-r--r--   1 root   root   3.2M Sep  6 10:47 GE8kUsers
-rw-r--r--   1 root   root   3.6M Sep  6 10:46 GE9kUsers


Incase your wondering the files sizes as the users decreased in number...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 06, 2005, 11:02:36 AM
The only problem with streaming in the points to what the user is viewing if possible would be what if there zoomed out to see the world map? How many and who gets shown there?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 06, 2005, 11:02:41 AM
Maybe postcode and surrounding areas is the better option? or doing it by so many points long/lat?

Members would then be able to use it as a tool - rather than a 'wow look at the thousands of pretty pins'  ;D

Im sure it would have more practical use that way... otherwise looking at an image of all members would be a waste of resources - even though it might look good.

I guess it could be drawn offline and ftp'd as a non interactive image once a month/week for those that want to see how the whole memberbase spreads out across the world?

Maybe Im talking gibberish :)

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 06, 2005, 11:06:10 AM
Here is an idea, use postalcode for over 1k users, bound to be a few repeats, and list them in a bubble per postalcode, and if who is viewing wants to take a closer look, can click a link in the bubble which will zoom in on area/plot pins for a predetermined area around the center?

*edit* think we just both thought of this at the same time, just one of us is a slow typer */edit*

As for drawing every pin on the map and making it a static image, not sure how to go about that one yet...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 06, 2005, 11:12:08 AM
Yep - I say go with that... and perhaps let the admins set how many pins to display at a time?

It certainly makes much better sense and better use of resources.

sounds like a plan :)

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 06, 2005, 11:16:11 AM
Alrighty, I will get on that, may not get that feature done before I have to leave for class/an appointment this afternoon.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 06, 2005, 03:30:30 PM
I like the ability for users to place them pin.  That way it's up to them how accurate they want to be with where they live.  I know for a fact it is possible to dynamically load the info but have no idea how.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: vdubbia on September 06, 2005, 09:57:43 PM
a different app, but check out www.clustrmaps.com to see how they address multiple 'pins' in close proximity.

You can see it in action on my blog: www.vertiblog.com in the upper right hand corner.

Google maps is the way to go, though, and I think to represent every user might in fact be overkill unless you can limit it to the state/province/local level.  Maybe have a different color pin to represent density?

They do create a static image and update it for retrieval daily.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: vdubbia on September 06, 2005, 10:01:43 PM
Quote from: Ride on September 06, 2005, 03:30:30 PM
I like the ability for users to place them pin.  That way it's up to them how accurate they want to be with where they live.  I know for a fact it is possible to dynamically load the info but have no idea how.

But then you'd have people wishing they were in Hawaii or Jamaica and posting pins where they don't really belong. 
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Gobalopper on September 06, 2005, 10:14:58 PM
TLM one thing you could do to reduce the javascript size is assign things like this to variables:
                    icon.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
                    icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";


They are just strings and repeated all over the place.

The best way to limit the number of pins shown may be to show an "area" of pins. So for example store the co-ordinates of Japan and have a dropdown that users select to just see the pins from that area.

For the world view instead of showing each pin do it by density marked out by grids. That would help load times.

Or just show less data about the user... or if its possible use the same technology Google Maps uses to dynamically load the user details into the bubble.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 06, 2005, 10:32:40 PM
Quote from: Gobalopper on September 06, 2005, 10:14:58 PM
TLM one thing you could do to reduce the javascript size is assign things like this to variables:
                    icon.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
                    icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";


They are just strings and repeated all over the place.
You know I started down that path but I dunno why I did not finish that up...  I have like it is for gender purposes but could easily change that some and it would be much better..

*edit* Think I got it a bit more simplified but one of my testers says it does not load now in IE so time to chase that down... */edit

Quote from: Gobalopper on September 06, 2005, 10:14:58 PM
The best way to limit the number of pins shown may be to show an "area" of pins. So for example store the co-ordinates of Japan and have a dropdown that users select to just see the pins from that area.

For the world view instead of showing each pin do it by density marked out by grids. That would help load times.

Or just show less data about the user... or if its possible use the same technology Google Maps uses to dynamically load the user details into the bubble.
Well on my site that is certainly possible seeing how for part of the site is using a continent as to help trim a list of xfire names, maybe I could use same thing to help control the pins like your saying.

I was just looking thru the api some more and looked at where the google code apparently can phrase a xml file of lat/long cord.  Only question I have is if it supports data as well.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 06, 2005, 10:58:29 PM
Quote from: wowzer on September 06, 2005, 10:01:43 PM
Quote from: Ride on September 06, 2005, 03:30:30 PM
I like the ability for users to place them pin.  That way it's up to them how accurate they want to be with where they live.  I know for a fact it is possible to dynamically load the info but have no idea how.

But then you'd have people wishing they were in Hawaii or Jamaica and posting pins where they don't really belong. 

They could do the same thing with zip code.  I see your point though.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: vdubbia on September 06, 2005, 11:40:15 PM
Quote from: Ride on September 06, 2005, 10:58:29 PM
Quote from: wowzer on September 06, 2005, 10:01:43 PM
Quote from: Ride on September 06, 2005, 03:30:30 PM
I like the ability for users to place them pin.  That way it's up to them how accurate they want to be with where they live.  I know for a fact it is possible to dynamically load the info but have no idea how.

But then you'd have people wishing they were in Hawaii or Jamaica and posting pins where they don't really belong. 

They could do the same thing with zip code.  I see your point though.

Actually you're right.  How about the pins resolving by IP?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 07, 2005, 12:01:09 AM
Quote from: wowzer on September 06, 2005, 11:40:15 PM
Quote from: Ride on September 06, 2005, 10:58:29 PM
Quote from: wowzer on September 06, 2005, 10:01:43 PM
Quote from: Ride on September 06, 2005, 03:30:30 PM
I like the ability for users to place them pin.  That way it's up to them how accurate they want to be with where they live.  I know for a fact it is possible to dynamically load the info but have no idea how.

But then you'd have people wishing they were in Hawaii or Jamaica and posting pins where they don't really belong. 

They could do the same thing with zip code.  I see your point though.

Actually you're right.  How about the pins resolving by IP?


I think we are getting off track here.  Let's get the core of the code working first.  Resolving by IP is very general and usually not very acurate.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 09, 2005, 04:05:43 PM
Well on my test server I am playing with loading the pins via XML now.  The live site I have been giving you guys still has old way.  I am running into same limitations with XML, so many then browser lockup.

So right now I would say its functional for a test on other than my site.  Unfortantly I stink at making a mod package, anyone of us want to do that for me?

(This version wont be release but instead tested by us that have posted in this thread already)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 09, 2005, 04:43:42 PM
Quote from: TLM on September 09, 2005, 04:05:43 PM
Well on my test server I am playing with loading the pins via XML now.  The live site I have been giving you guys still has old way.  I am running into same limitations with XML, so many then browser lockup.

So right now I would say its functional for a test on other than my site.  Unfortantly I stink at making a mod package, anyone of us want to do that for me?

(This version wont be release but instead tested by us that have posted in this thread already)

If you want to send me the files that have been modified this is something I can do.  I'd like to test it out too.  I have 3 different testing servers all with different configurations.  You can email me at ride[at]fracturedmedia.com
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 10, 2005, 02:54:36 PM
May have an idea for kind of a fake stream of data.  Currently looking at the API documentation, it appears I could get the bounds of whats being viewed.  With that, I could use the xml method of data, produced by a php script with a "limitation window".  Where js would query the script with the bounds to query from the db, and hard cap at say 500 pins max viewable.  Of course the pins would probally be a random choosing from the whole.  If it is indeed possible which I think it is, the only thing left would be geocoding for those to layze to go place there pins, and from what it sounds like you guys already have that done.

Sorry Ride, got carryed away in Guild Wars since last post till now, and well....

/me wanders back to the code, to see if the idea can be done.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 10, 2005, 03:07:43 PM
I have attached my UK SQL data for postcode/long/lat lookups :)

I havent done anything with the USA  side of things  - so dont have zipcode - But I think Ride might have ?

Hope that helps,

Tony
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 10, 2005, 05:49:05 PM
Well it certanly looks possible, managed to figure out how the code returns its bounds and I have come up with a small little table or so of how the reloading of data should go.  Want a little input on that from you guys...


ZoomIf zoom changeDescription
17UhhThe entire world multiple times...
16Random Pins up to 250(?)/Base/StartThe entire world
15Use from previous levelThe entire world minus a little bit
14Reload to within bounds, 250(?)A continent at best.
13Use from previous level, unless change greatA bit closer to the continent
12Reload to +10 of bounds, 250(?)A large section of the area
11Use from previous levelA section of the area
10Relaod to +5 of bounds, 250(?)State size
9Use from previous levelSection of state size
8Reload to +2 of bounds, 250(?)Larger than a city
7Use from previous levelA city
6Use from previous levelMajor roads in a city
5Use from previous levelStart to see indivdual streets
4Use from previous levelCan ident indivdual streets
3Use from previous levelCan ident indivdual streets
2Use from previous levelCan ident indivdual streets
1Use from previous levelCan ident indivdual streets
0Use from previous levelCount the cars...

Rough refrencing is provide below, starting at 16...
http://maps.google.com/maps?q=Detroit&spn=167.668829,562.429688&hl=en
Its not a great refrence due if you are using a high resolution.  I really produced table on my site but that code will change before people read it.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 10, 2005, 05:53:51 PM
Maybe its because of the amount of wine I have consumed tonight - but Im not sure I understand your question ;D

Can you be more specific please :)

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 10, 2005, 05:56:11 PM
It could be my brain is in "lets code!" mode and english goes down the tubes when I am like that

The interval between data reloading if zooming in/out on the map, table has it for going in...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 10, 2005, 05:59:57 PM
Of course moving about a current zoom level will have to be figured in as well but right now just concerned with keeping the pin population down to a managable level.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 10, 2005, 06:09:44 PM
I certainly think 250 is a good amount of pins - especially if IE is going to take a while to draw them :)

As far as the suggestions on your table - they look about right to me.

I take it when you say 'Use from previous level' you are suggesting using thetotal amount of pins from that level?

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 10, 2005, 06:12:07 PM
Means use previous levels data, and the reload is where all pins removed and data is called again but within the restrictions.  Same will be if zoomed in past... 15 I think (not checking)... and you move around on the map enough gonna have to clear old and download a new set of data for the new pins.  I dunno how well this idea is gonna work but should be ok I think.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 10, 2005, 06:20:09 PM
Its certainy going to be a bit of processing :)

I guess the best way is to test it in a live situation with lots of people.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 10, 2005, 06:21:24 PM
Dont forget my 10k pin monstrosity. :P
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 11, 2005, 03:33:07 PM
Started work on this and then relized, how I have things right now will cause issues...  Gonna have to alter the smf_members table instead of storing each in smf_themes on there own row.  Which means a larger edit.  How to store data to there from the editing of the profile im not sure how to do off hand but will be looking into it....

Unless I store both lat and long in the same var on smf_themes sperated by a ","... But that would then cause issues when having to pull an area of points having to read all and split to see if there the ones needed.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 12, 2005, 12:11:23 AM
Just got the basic idea of how to check if the user moved beyond the boundry down on paper, dont have time tonight to finsh it up into real jscript but should be able to do it this evening (noted its now just after midnight localy).

I just hope it works when I put it into real code. Then we have a simi-streaming of points to the end user.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 12, 2005, 05:21:15 AM
I'm sure it will work :) - youve done very well so far ;)

Good luck,
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 13, 2005, 12:23:51 AM
Despite the fact I came home sick today, I still tried, got the xml to reload but not when I wanted.  At least something went half way right today. :)

I suspect some logic problem that I can see past the fuzzy greyness for right now due to about to fall asleep at the keyboard due to the cold medicine
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 13, 2005, 10:17:54 AM
I found this simple code for calculating the distance in kilometers using long/lat

http://www.web-max.ca/PHP/misc_2.php

I mentioned it earlier in this thread that it would be nice if a member could click on another members profile and see exactly how far away they are.

Once he mod is working that is :)

Hope your feeling better soon.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 13, 2005, 01:23:51 PM
Cool, also found how to add a scale to the display, does mi and km.  Although I dont think its right at all.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 14, 2005, 05:39:52 PM
Did you need a US zipcode/lon/lat database?  I have a sql dump file if you would like it.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 15, 2005, 05:42:00 AM
Quote from: Ride on September 14, 2005, 05:39:52 PM
Did you need a US zipcode/lon/lat database?  I have a sql dump file if you would like it.

If you dont mind I'd like that if you have it in sql aready :)

Nothing to do with this though - just to play with :)

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 18, 2005, 11:12:43 PM
Sorry guys, got side tracked in something else, but did solve at least one of the 2 major problems in the process. ;)

All thats left now is to figure out whats wrong with my logic in helping keep the number of pins limited.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 21, 2005, 11:21:01 AM
Ok, I think im getting close to having this released, I am though thinking of making it 1.1 only, seeing how its due out sometime soon.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Tony Reid on September 23, 2005, 05:28:33 AM
1.1 makes perfect sense - especially as its RC1 already :)

no point in having two sets of code.

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 23, 2005, 10:34:31 AM
Quote from: TLM on September 21, 2005, 11:21:01 AM
Ok, I think im getting close to having this released, I am though thinking of making it 1.1 only, seeing how its due out sometime soon.

Do you have it working with 1.05 now?  If so, I'd love to use that. ;)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: TLM on September 24, 2005, 12:52:50 PM
I dont plan on working a 1.05 version, only 1.1
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on September 24, 2005, 01:54:09 PM
Well, I'm sure I can make it work with 1.05. 
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on October 11, 2005, 05:45:01 PM
What's the latest on this?  Do you have a working demo up?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: kent on October 11, 2005, 06:13:24 PM
this may be off topic, but I remember about a projec called icbm :

here is a related link,

http://www.linuxjournal.com/article/8025 (http://www.linuxjournal.com/article/8025)

the aim was to tell you the geolocation of a website, obviously not what you want to do, but you might get some info or ideas about how they did it.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Slack on October 19, 2005, 04:52:54 PM
Have you guys checked out Frapper Maps?

Looks like a good solution to me.

http://www.risingconcepts.com/frapper/unofficialmartinguitarforum
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on October 19, 2005, 05:28:40 PM
Quote from: Slack on October 19, 2005, 04:52:54 PM
Have you guys checked out Frapper Maps?

Looks like a good solution to me.

http://www.risingconcepts.com/frapper/unofficialmartinguitarforum


I'd love to be able to integrate that but it's a stand alone service.  I really need something like that for ride sharing.  I'd pay if anyone here is interested.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on November 07, 2005, 08:28:07 PM
ok, check it out.  It's easier than I thought to get user coordinates.  Look at this example I made.  When you click on the map, it will put those coordinates into a form.  This can easily be added to the members table.  I'm just trying to think of the best place to put this in the profile now.  Down at the very bottom or make it's own section.  Ideas anyone?


http://www.ridesocal.com/maps/index2.html
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on November 07, 2005, 08:47:00 PM
I think I may do a popup with the map and a submit form to update the member table independently of the profile.  Should it go in the member table or theme table like custom profile fields do?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF
Post by: Ride on November 09, 2005, 10:26:24 PM
Well, I'm almost done!  I've got the part to get the coordinates into the database working perfect.  The member clicks on the map in their profile to set their location.  Now just gotta figure out how to do a 'for each' to echo all the members into the javascript to show all the markers for each member.

You can play with it on my site if you'd like.  I've setup a test account.  username: test    password: 54321
http://www.ridesocal.com


By the way, if anybody can help with this ---->  http://www.simplemachines.org/community/index.php?topic=56035.0
I will have the whole thing done very soon to share with everyone.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: JayBachatero on November 09, 2005, 11:56:18 PM
Nice job so far.  I'm liking this a lot.  Will there be another page with all the members together?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on November 10, 2005, 12:08:21 AM
Quote from: JayBachatero on November 09, 2005, 11:56:18 PM
Nice job so far.  I'm liking this a lot.  Will there be another page with all the members together?

Thanks, yes there will be.  That's what I'll be working on tomorrow.  I need this question answered first though! ---->  http://www.simplemachines.org/community/index.php?topic=56035.0
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on November 11, 2005, 02:18:27 AM
Here's what I have so far...


http://www.ridesocal.com/maps/
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: JayBachatero on November 11, 2005, 01:33:13 PM
I will be using this for my site when it comes out.  Great job.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on November 11, 2005, 02:19:06 PM
If anyone is familiar with the google maps api or is really good with javascript, I could really use some help.  There is a lot to be done before I can release this as an actual mod.  I will soon however be able to post instructions on how to do it once I get all the bugs worked out.  Anyways, if anybody can help me out a bit, please message me or email me at  royce[at]fracturedmedia.com
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: xtremecruiser on November 13, 2005, 10:54:12 AM
Quote from: Ride on November 11, 2005, 02:19:06 PM
If anyone is familiar with the google maps api or is really good with javascript, I could really use some help.  There is a lot to be done before I can release this as an actual mod.  I will soon however be able to post instructions on how to do it once I get all the bugs worked out.  Anyways, if anybody can help me out a bit, please message me or email me at  royce[at]fracturedmedia.com
I was using Frapper on my site for the members when I saw invision has a mod for goggle maps ( seems frapper is google maps anyway ) so I did a search on smf and found this thread.
I looked at your site and I must say it looks very impressive ( the MPspace add is cool too )
If you need someone to test your beta's let me know I have my sites mirrored so I can do testing.
BTW your site is very impressive looking.

Invision uses
D2-Google Member Map 1.0 Dean (D-Scripting) (http://www.dscripting.com/)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Harelin on November 13, 2005, 03:22:04 PM
Any chance this will be 1.0.5 compatible?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on November 13, 2005, 04:12:37 PM
Quote from: Harelin on November 13, 2005, 03:22:04 PM
Any chance this will be 1.0.5 compatible?

I'm actually using this with 1.05 right now.  I don't see any big differences I'll have to make between 1.05 and 1.1.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Harelin on November 13, 2005, 07:21:04 PM
Good to hear.  :)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: xtremecruiser on November 13, 2005, 07:22:04 PM
Quote from: Ride on November 13, 2005, 04:12:37 PM
Quote from: Harelin on November 13, 2005, 03:22:04 PM
Any chance this will be 1.0.5 compatible?

I'm actually using this with 1.05 right now.  I don't see any big differences I'll have to make between 1.05 and 1.1.

I see that TLM is also using a system like yours and is using RC1.1
Have yall worked together on this ?
I am tired of using Frapper and getting so many fake accounts with links that are just WRONG on it.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: emmaderijk on November 30, 2005, 05:15:26 PM
Is there aready more news about how things are going with this mod?
what i have seen is wow!!!! thanks for all the work!


Thanks
emma
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 17, 2005, 12:31:11 PM
Yes, I am again coding on this little mod some more, no job wants me, classes have ended, and I have no life.  Therefor I have lots of time.  Currently the there are two things holding me back right now from releasing this to the public, one, IE does not like to load the pins on the whole map, two, I can not get the packaging to work right.  So if any of you can package and get it to install/unintall I am willing to overlook the IE issue for now till I can figure out why its not loading the pins.

I have no plans to backport this to 1.0.5 of SMF, I see nothing wrong with 1.1Rc1.

http://www.teamplayfirst.com/forums/index.php?action=membermap - Works in FF but not IE for me, if anyone can get an error message or anything for IE, I would much appriciate it.

http://www.teamplayfirst.com/forums/index.php?action=.kml - Got Google Earth (http://earth.google.com/)?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on December 17, 2005, 12:46:15 PM
I had a problem with IE early on too.  I need to look back and see how I solved the problem.  I'll let you know.

http://www.ridesocal.com/maps
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: JayBachatero on December 17, 2005, 02:06:31 PM
Looking good TLM and Ride.  TLM take a look at Package SDK to help you with the installation and it tests out the script for you.

Package SDK, anyone? (http://www.simplemachines.org/community/index.php?topic=20319.0)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 17, 2005, 03:31:36 PM
Tries one more time....
Cross your fingers....

*Update, so far so good...
http://tlm.homelinux.net/smfbase/package-sdk_0-5/test_modification.php?mod_file=/var/www/localhost/htdocs/smfbase/package-sdk_0-5/test.tar
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: PhatTyres on December 17, 2005, 03:52:47 PM
The only thing holding me back on 1.0.5 is a few packages/mods are not yet updated to 1.1rc1 otherwise I'd be on board allready...
Ride is using it on 1.0.5 so I hope it can be converted?

Looking Forward and Thanks for the great work you guys!!!
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 17, 2005, 04:14:33 PM
And kaboom like I though...

Problem more than likly is how I encapsulated a jscript using the cdata tags... */me wanders off thinking of a fix for this...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 17, 2005, 09:35:58 PM
I have the package almost ready, it might make it by December 18, 2005, 12:00:00 AM.

Right now I am troubleshooting where I forgot things and then to figure how to add a SQL statment and its done and then the partying may start.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 12:08:05 AM
Ok its gonna be a little longer, ran into a snag with using db_query not liking to use ALTER on the members table, having to think of a way around it...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: Ride on December 18, 2005, 12:29:39 AM
Quote from: TLM on December 18, 2005, 12:08:05 AM
Ok its gonna be a little longer, ran into a snag with using db_query not liking to use ALTER on the members table, having to think of a way around it...

Any thing I can help with?  I've been doing a lot of MySql lately and know my stuff pretty well.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 01:03:49 AM
Get,

ALTER TABLE `smf_members`
ADD `longitude` DECIMAL( 18, 15 ) NULL ,
ADD `latitude` DECIMAL( 18, 15 ) NULL ;


to work with smfs internal db_query so I dont have to go about making a connection myself.  Yes I know I am a layze bum for not making my own link.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 02:17:10 AM
Ok its not gonna make it out for another few hours, I am about to fall asleep.  So what this means is, I am going to sleep, and when I wake I shall make one more pass and check of things dispite some IE error on the action=membermap and me being layze on the SQL statment, then I shall submit it.  Look for it sometime tommarow hopefully.  :)

Also thanks to JayBachatero, it is almost RC2 complient as well due to his testing of it on RC2, only a few areas will have to be edited once RC2 comes out.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 11:19:13 AM
This has been submited to the mod directory, waiting approval.  Oh and for you soles still using 1.0.5, your in luck, I said I would not, but I am, only due to its a little editing not much it seems, so by the time it gets approved it might also be 1.0.5 compatable as well.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: snork13 on December 18, 2005, 11:23:04 AM
excellent...thanks for the time and energy spent on this mod!

-snork
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 12:18:33 PM
Ok I just updated it to have 1.0.5 compatability as well,  just be sure to read the readme that comes along with it, for this thing is not completely done.

http://mods.simplemachines.org/index.php?mod=241 - Its unapproved so you wont be able to download it till it becomes approved.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: HoTmetal on December 18, 2005, 01:01:46 PM
Quote from: TLM on December 18, 2005, 12:18:33 PM
Ok I just updated it to have 1.0.5 compatability as well,  just be sure to read the readme that comes along with it, for this thing is not completely done.

http://mods.simplemachines.org/index.php?mod=241 - Its unapproved so you wont be able to download it till it becomes approved.

QuoteWarning: this mod is currently not approved!
Please do not use this mod unless you are completely sure of the consequences!
I thought I'd take my chances, but it really wont let me D/L.... oh well, it should be approved soon right?

Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 01:05:07 PM
Well you sir are first victom of the DUH, I stated you wont be able to till its been approved. :P

Yes hopefully soon, but not sure on that ETA.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 04:42:14 PM
Just solved the install SQL problem, bumped to 0.45 just for that, so now all it needs is approval!
Also did a quick test check on 1.0.5 and 1.1 RC1 to make sure that it works too.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 08:49:21 PM
http://www.simplemachines.org/community/index.php?topic=61213.0
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: PhatTyres on December 18, 2005, 10:09:42 PM
Thanks for the Extra Effort to Port 1.0.5
You Rock...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 18, 2005, 10:23:08 PM
Accualy it was little effort.  I finshed the 1.1 part and could not think of something to do so I said, just for laughs, lets see how much I would need to change.  It came out to only 3 spots, and they were rather simple fixes, so you cursed 1.0.5's got lucky. *shakes fist* :P
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: HoTmetal on December 19, 2005, 01:22:33 AM
Cool mod, I put this on my X-mas list ......
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: PhatTyres 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.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 19, 2005, 09:04:49 PM
Quote from: PhatTyres 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.
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.

Quote from: PhatTyres on December 19, 2005, 08:44:32 PM
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?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: HoTmetal 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.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: PhatTyres on December 19, 2005, 09:14:12 PM
QuoteYour 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.

QuoteSounds 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.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 19, 2005, 09:15:18 PM
Quote from: rickc 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.
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 from: PhatTyres on December 19, 2005, 09:14:12 PM
QuoteYour 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 from: PhatTyres on December 19, 2005, 09:14:12 PM
QuoteSounds 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. :)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: HoTmetal on December 19, 2005, 09:19:52 PM
Quote from: TLM on December 19, 2005, 09:15:18 PM
Quote from: rickc 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.
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.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM on December 19, 2005, 09:21:27 PM
Quote from: rickc on December 19, 2005, 09:19:52 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.
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: HoTmetal on December 19, 2005, 09:33:10 PM
Quote from: TLM on December 19, 2005, 09:21:27 PM
Quote from: rickc on December 19, 2005, 09:19:52 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 ~~~
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM 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?
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: HoTmetal on December 19, 2005, 09:43:01 PM
Quote from: TLM 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?
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...
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM 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. :)
Title: Re: Looking for help to integrate GOOGLE MAPS+SMF **Demo available
Post by: TLM 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...


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...

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.