I think if you have an address in your link, the longitude and latitude should be automatically filled by Google's Geo coding. If you have the templates as they should be and an address in your link, it should work without any extra customisation.
Yeah i did try input some addresses but the google map still not appearing. And for templates, have not really touch on that, trying to understand how to functions works here and there before customise.
Paul wrote: You're sure you entered the map key correctly, no leading or trailing space?
Yes Paul. I did regenerate the key and re-submit it but still no visible result under details page. Manage to turn on google map under category section but the map is pointing to the center position of the whole map which is somewhere near africa continent.
jayweb wrote: You have checked your displaylinks.tpl template to make sure the google maps code is there havn't you?
Yeap displaylinks.tpl is displaying google map in the category listing with a default LONGITUDE and LATITUDE which is '0'.
The details.tpl page failed to display anything. Code intact as below. Just wondering where does it capture values for 'LINKLATITUDE' and 'LINKLONGITUDE' from? Do i need to specify the values anywhere within the admin tools? I assume the values is currently null and that is most likely the reason for it to fail. Thanks
<IF {SWITCH_MAP} and {LINKLATITUDE} and {LINKLONGITUDE}> <script src="http://maps.google.com/maps?file=api&v=2&key={GOOGLEMAPSKEY}" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng({LINKLATITUDE}, {LINKLONGITUDE}), 13); var mapControl = new GMapTypeControl(); map.addControl(mapControl); map.addControl(new GSmallMapControl());
I'm sort of in the same boat. However, unlike damon, I have no problem getting the map to display on category pages because the only conditional in displaylinks.tpl is <IF {SWITCH_CATMAP} and {NUMPINS}>. So, I'll get a map on every category page even if it is a picture of the ocean.
However, I still don't see where longitude and latitude are set, either by the admin, the link owner, or some automated script process. Thus, once I set a physical address in the submitlink or editlink forms, the longitude and latitude are not set. I verified this by examining the links table. I also poured through the crons to see if maybe it would make some call somewhere to set it at some future date/time, but there's nothing in there.
The knowledgebase here makes it sound like its fully automatic (updated 4/2008), but this older post by Paul on the forums from March 2007 makes it sound like the process is a very iffy thing. I'm guessing the post is outdated since some of the instructions clearly don't apply (like creating custom fields that already exist in the dB for Ver 5.0.2.
Incidentally, I also did the above XML test with no issues (and good coordinates returned) on several real-world addresses.
As an aside to the above concern, I should probably also point out an issue with a javascript error and my fix for it. It maybe quite possible that the only reason I'm even getting this javascript error is because I'm not getting the longitude and latitude fields to populate as mentioned above.
Still, for anyone else who's particular about these sorts of things (as am I) you will get a javascript error on your link detail pages if you have maps switched on, but don't have the latitude or longitude fields populated for that link. That's because your details template (or detailscomments) calls the Google map code only if those two fields are populated and GMaps is switched on.
However, in your wrapper body tag, the load and unload functions are mentioned if maps is switched on (but obviously no check on those two fields since it isn't relevant to a displaylinks page. So, you'll get an error for an undefined function. It won't break anything, but on some browsers (like IE) the error can be rather intrusive with a popup warning depending on the user's settings.
Thus, for now anyway, I altered the body tag conditionals in the wrapper to avoid this happening. If you decide to use this, realize that a) the problem above could be solved within hours/days thus rendering this issue moot, b) I may not have written this conditional in the most PHP-server saving way, and c) that this only applies if you want maps on detail pages, and multi-pin maps on each category page (which I believe is the default for WSN-Links for my version anyway (5.0.2), so if you are doing something crazy-different (like showing maps on submit links pages, search results, etc), alter this accordingly if you have the same issue. Oh, I should also mention I'm running XHTML 1.0 Strict which shouldn't have any bearing on this at all, but since the default install is Transitional, I mention it just in case it somehow applies which I can't think of at 3AM.
Here's the original code as it comes out of the box:
Not sure if Paul is talking to me or someone else, but since I'm the only who mentioned a change, I'm guessing me? If so, he's right. My change is not working correctly although I don't know why. Maybe the TID isn't meant to be used in such a manner?
Anyway, after switching it back and trying the query output that Paul wanted, it does seem to be working as expected. It's odd because I made no changes at all since posting the above. I'm almost wondering if Gmaps API was down or something the day I did it.
Here's the relevant portion of the output that updates the longitude and latitude. I tried this on multiple links (both for updating and adding) and it seems to perform well. (*note: I did alter the records email address in this posting so we don't contribute to any spam for them, but everything else is "as is".
Query 14: SELECT `id`,`name`,`parent`,`validated`,`description`,`time`,`parentnames`,`parentids`,`numlinks`,`hide`,`lastlinktime`,`custom`,`lastedit`,`moderators`,`headerinfo`,`related`,`numsub`,`type`,`permissions`,`subscribers`,`subscriber`,`mixtypes`,`isalbum`,`orderlinks`,`totalcomments`,`ulsearchmax`,`ulsearchquery`,`ulsearchadult`,`alias`,`catcols`,`linkcols`,`dmozpath`,`sponsorlinks`,`views`,`customwrap`,`deleted`,`reqlinks`,`reqcoms`,`reqlinksdelay`,`priority`,`levelsdeep`,`lastposterid`,`lastpostername`,`lastcommenttime`,`lastthreadid`,`lastthreadtitle`,`linkshere`,`unvalidatedlinks`,`unvalidatedcomments`,`actaslink`,`countposts`,`subcatshtml`,`linksperpage`,`wysihtml`,`numonline`,`sponsorship`,`lastprofileurl`,`defaultnoaccess`,`lastthreadurl`,`lastposturl`,`specialurl` FROM wsnlinks_categories WHERE id=106
Load time so far: 0.12 seconds.
returning 28.159656, -80.602886 from 1757 South Patrick Drive, Indian Harbour Beach, Florida, 32937, United States of America200geocode 1757 S Patrick Dr, Satellite Beach, FL 32937, USA USFLSatellite Beach1757 S Patrick Dr32937-80.602886,28.159656,0 thanks to data from maps.google.com/maps/geo?q=...CgJ75c5vT1peT0JPO-6I7uoixw
Query 15: SELECT `id`,`name`,`parent`,`validated`,`description`,`time`,`parentnames`,`parentids`,`numlinks`,`hide`,`lastlinktime`,`custom`,`lastedit`,`moderators`,`headerinfo`,`related`,`numsub`,`type`,`permissions`,`subscribers`,`subscriber`,`mixtypes`,`isalbum`,`orderlinks`,`totalcomments`,`ulsearchmax`,`ulsearchquery`,`ulsearchadult`,`alias`,`catcols`,`linkcols`,`dmozpath`,`sponsorlinks`,`views`,`customwrap`,`deleted`,`reqlinks`,`reqcoms`,`reqlinksdelay`,`priority`,`levelsdeep`,`lastposterid`,`lastpostername`,`lastcommenttime`,`lastthreadid`,`lastthreadtitle`,`linkshere`,`unvalidatedlinks`,`unvalidatedcomments`,`actaslink`,`countposts`,`subcatshtml`,`linksperpage`,`wysihtml`,`numonline`,`sponsorship`,`lastprofileurl`,`defaultnoaccess`,`lastthreadurl`,`lastposturl`,`specialurl` FROM wsnlinks_categories WHERE id=106
Load time so far: 0.34 seconds.
Load time so far: 0.34 seconds.
Query 16: UPDATE wsnlinks_links SET title = 'Advanta Technologies, Inc.', url = 'http://www.advanta-tech.com/', description = 'Advanta Technologies was founded as a document management and imaging specialist in 1993. The company has been a Microsoft Partner since 1995 and a FileNET ValueNET Partner from 1998 until 2003. Advanta Technologies is also a certified reseller for capture products and toolkits from Pixel Translations, a subsidiary of Captiva Software. Our system lab includes servers and workstations operating with Microsoft's Enterprise Software for business solutions and Kodak document scanners.', rating = '0', votes = '0', catid = '106', email = 'fakeinfo@fakeadvanta-tech.com', hide = '0', ownerid = '1', type = 'regular', funds = '0', expire = '0', ip = '77.88.25.28', recipurl = 'http://', hitsin = '0', recipwith = '', related = '', hitsintemp = '0', threadclosed = '0', effectivetime = '', feedurl = '', ordercomments = '', address = '1757 South Patrick Drive', city = 'Indian Harbour Beach', state = 'Florida', country = '133', latitude = '28.159656', longitude = '-80.602886', zip = '32937' WHERE id=1106
Load time so far: 0.34 seconds.
However, a javascript error is still generated on any links that don't have an address (and thus resultant long/lat info).
BTW, I should note that I was only updating and changing the address fields. WSN-Links chose to update a whole smorgasboard of fields that I hadn't touched (I'm assuming for the purposes of cutting down on a big PHP loop through each field). Just wanted to clarify in case anyone thinks I was adding a whole new record or changing all the fields.
0/5
1
2
3
4
5
Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.
Comments on Google Map
Member
Usergroup: Customer
Joined: Oct 14, 2005
Location: Singapore
Total Topics: 11
Total Comments: 31
Hi Paul
How to make it works under details page?
Where do we declare var LINKLATITUDE and LINKLONGITUDE?
Switches ON: Google Map, Address, Category Google Map
Registered: Google Map API Key
Thank
Forum Regular
Usergroup: Customer
Joined: Nov 27, 2006
Total Topics: 187
Total Comments: 465
I think if you have an address in your link, the longitude and latitude should be automatically filled by Google's Geo coding. If you have the templates as they should be and an address in your link, it should work without any extra customisation.
Member
Usergroup: Customer
Joined: Oct 14, 2005
Location: Singapore
Total Topics: 11
Total Comments: 31
Yeah i did try input some addresses but the google map still not appearing. And for templates, have not really touch on that, trying to understand how to functions works here and there before customise.
What else did i miss?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
You're sure you entered the map key correctly, no leading or trailing space?
Member
Usergroup: Customer
Joined: Oct 14, 2005
Location: Singapore
Total Topics: 11
Total Comments: 31
You're sure you entered the map key correctly, no leading or trailing space?
Yes Paul. I did regenerate the key and re-submit it but still no visible result under details page. Manage to turn on google map under category section but the map is pointing to the center position of the whole map which is somewhere near africa continent.
Thanks
Forum Regular
Usergroup: Customer
Joined: Nov 27, 2006
Total Topics: 187
Total Comments: 465
You have checked your displaylinks.tpl template to make sure the google maps code is there havn't you?
Member
Usergroup: Customer
Joined: Oct 14, 2005
Location: Singapore
Total Topics: 11
Total Comments: 31
You have checked your displaylinks.tpl template to make sure the google maps code is there havn't you?
Yeap displaylinks.tpl is displaying google map in the category listing with a default LONGITUDE and LATITUDE which is '0'.
The details.tpl page failed to display anything. Code intact as below. Just wondering where does it capture values for 'LINKLATITUDE' and 'LINKLONGITUDE' from? Do i need to specify the values anywhere within the admin tools? I assume the values is currently null and that is most likely the reason for it to fail. Thanks
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Your maps key just isn't working for geocoding, apparently. Remote URL functions do work on your server?
Does maps.google.com/maps/geo?q=...put=xml&key=yourapikeyhere work for manually?
Member
Usergroup: Customer
Joined: Oct 14, 2005
Location: Singapore
Total Topics: 11
Total Comments: 31
Your maps key just isn't working for geocoding, apparently. Remote URL functions do work on your server?
Does maps.google.com/maps/geo?q=...put=xml&key=yourapikeyhere work for manually?
XML as below generated when i apply above link with my key.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Do pageranks also not work for you? If they don't, google must've banned your server.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Also, turn on debug mode and hit stop on the redirect page after submitting. Post the debug output from there.
Beginner
Usergroup: Customer
Joined: Aug 31, 2008
Location: Melbourne, FL
Total Topics: 3
Total Comments: 7
I'm sort of in the same boat. However, unlike damon, I have no problem getting the map to display on category pages because the only conditional in displaylinks.tpl is <IF {SWITCH_CATMAP} and {NUMPINS}>. So, I'll get a map on every category page even if it is a picture of the ocean.
However, I still don't see where longitude and latitude are set, either by the admin, the link owner, or some automated script process. Thus, once I set a physical address in the submitlink or editlink forms, the longitude and latitude are not set. I verified this by examining the links table. I also poured through the crons to see if maybe it would make some call somewhere to set it at some future date/time, but there's nothing in there.
The knowledgebase here makes it sound like its fully automatic (updated 4/2008), but this older post by Paul on the forums from March 2007 makes it sound like the process is a very iffy thing. I'm guessing the post is outdated since some of the instructions clearly don't apply (like creating custom fields that already exist in the dB for Ver 5.0.2.
Incidentally, I also did the above XML test with no issues (and good coordinates returned) on several real-world addresses.
Beginner
Usergroup: Customer
Joined: Aug 31, 2008
Location: Melbourne, FL
Total Topics: 3
Total Comments: 7
As an aside to the above concern, I should probably also point out an issue with a javascript error and my fix for it. It maybe quite possible that the only reason I'm even getting this javascript error is because I'm not getting the longitude and latitude fields to populate as mentioned above.
Still, for anyone else who's particular about these sorts of things (as am I) you will get a javascript error on your link detail pages if you have maps switched on, but don't have the latitude or longitude fields populated for that link. That's because your details template (or detailscomments) calls the Google map code only if those two fields are populated and GMaps is switched on.
However, in your wrapper body tag, the load and unload functions are mentioned if maps is switched on (but obviously no check on those two fields since it isn't relevant to a displaylinks page. So, you'll get an error for an undefined function. It won't break anything, but on some browsers (like IE) the error can be rather intrusive with a popup warning depending on the user's settings.
Thus, for now anyway, I altered the body tag conditionals in the wrapper to avoid this happening. If you decide to use this, realize that a) the problem above could be solved within hours/days thus rendering this issue moot, b) I may not have written this conditional in the most PHP-server saving way, and c) that this only applies if you want maps on detail pages, and multi-pin maps on each category page (which I believe is the default for WSN-Links for my version anyway (5.0.2), so if you are doing something crazy-different (like showing maps on submit links pages, search results, etc), alter this accordingly if you have the same issue. Oh, I should also mention I'm running XHTML 1.0 Strict which shouldn't have any bearing on this at all, but since the default install is Transitional, I mention it just in case it somehow applies which I can't think of at 3AM.
Here's the original code as it comes out of the box:
Note the second closing angle-bracket at end in both above and below. Not a typo.
Now, here's what I came up with for now.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I'm 95% sure that change wouldn't work. Will look into an appropriate solution.
There are no apparent issues with any addresses I submit to the demo... just added www.wsnforum.com/linksuserd...nks/mount-diablo-3940.html
Until someone is willing to do as I asked in post #11 I can only randomly guess you've left a space around the key or something.
Beginner
Usergroup: Customer
Joined: Aug 31, 2008
Location: Melbourne, FL
Total Topics: 3
Total Comments: 7
Not sure if Paul is talking to me or someone else, but since I'm the only who mentioned a change, I'm guessing me? If so, he's right. My change is not working correctly although I don't know why. Maybe the TID isn't meant to be used in such a manner?
Anyway, after switching it back and trying the query output that Paul wanted, it does seem to be working as expected. It's odd because I made no changes at all since posting the above. I'm almost wondering if Gmaps API was down or something the day I did it.
Here's the relevant portion of the output that updates the longitude and latitude. I tried this on multiple links (both for updating and adding) and it seems to perform well. (*note: I did alter the records email address in this posting so we don't contribute to any spam for them, but everything else is "as is".
However, a javascript error is still generated on any links that don't have an address (and thus resultant long/lat info).
BTW, I should note that I was only updating and changing the address fields. WSN-Links chose to update a whole smorgasboard of fields that I hadn't touched (I'm assuming for the purposes of cutting down on a big PHP loop through each field). Just wanted to clarify in case anyone thinks I was adding a whole new record or changing all the fields.