GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Geonames search form  XML
Forum Index -> General
Author Message
australia4wd



Joined: 24/04/2006 13:50:49
Messages: 2
Offline

Hi
Love your site
I have been playing with intergration with google maps on my sitesand achieved success but nowhere as good as the info that can be gained from a search on your site.
Just wondering if it is ok to put a Search with geonames form and link - on my site: Something like:
Code:
<script type="text/javascript">
 function searchOnMap() {
   if (document.searchForm.q.value == '') {
     alert('Please enter a name.');
     return;
   }
 </script>
 <h3>Geo-Names</h3>
 <br>
 <br>
 <form name="searchForm" method="GET" action="http://www.geonames.org/search.html?">
 <input name="q" size="40" value="" type="text">
 <select name ="country"><option value="" selected > all countries</option><option value="AF"> Afghanistan</option><option value="AX"> Aland Islands</option><option value="AL"> Albania</option><Zimbabwe</option></select>
 <br><input type="submit" value="search">
 </form>


It seems to work okay but cant get the Show on Map to happen

Pete
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

Hi Pete

For a close integration with googlemaps into your own site, you should look at the JSON version of the full text search:
http://www.geonames.org/export/#fulltextSearch

A very basic example is here :
http://www.geonames.org/maps/json-googlemaps-example.html


I have fixed and improved a couple of things with the 'show on map' function. The following code snippet should work :

Code:
 <script type="text/javascript">
 function searchOnMap() {
   if (document.searchForm.q.value == '') {
     alert('Please enter a name.');
     return;
   }
   var q = encodeURIComponent(document.searchForm.q.value);
   if (document.searchForm.country.value != '') {
     q = q + '+country:' + document.searchForm.country.value;
   }
   window.open('http://www.geonames.org/maps/showOnMap?q='+ q,'geonames');
 }
 </script>
 


The url should look like this :
http://www.geonames.org/maps/showOnMap?q=sydney+country:AU

Please come back to me if it does not work or if you have other questions.

Marc

[WWW]
australia4wd



Joined: 24/04/2006 13:50:49
Messages: 2
Offline

Marc
Thanks for that
The tidied up Search script works well

I did have success a few days ago using the script in
http://www.geonames.org/maps/json-googlemaps-example.html

But I prefer the redirect to here as it provides a great resource and better info (including links to wikpedia and others). I also figure in this case - it is better to people use and visit the geonames site (which I hope provides a bit more support to the project)

Just for interest we are ging through a testing phase with a GPX file intergration (see an example HERE and we have a few extra features to bring online in next few weeks

Once again thanks
Pete
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team