Changeset 373 for trunk/npemap.org.uk
- Timestamp:
- Nov 19, 2006, 11:48:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/static/tiles/mapTiles.js
r361 r373 509 509 } 510 510 511 function postcodeLoc(jData) { 512 if (jData == null) { 513 // There was a problem parsing search results 514 return; 515 } 516 gotoLocation(Math.round(jData.e/1000), Math.round(jData.n/1000), 1); 517 518 } 511 519 512 520 function find() { 513 521 var where = $('where').value; 514 522 if (where.length > 0) { 515 request = 'http://ws.geonames.org/searchJSON?name=' + encodeURIComponent(where) + '&callback=getLocation&country=GB&fclass=P&fclass=T&style=SHORT'; 523 if (where.toUpperCase().match(/^([A-Z]+\d+[A-Z]?)\s*(\d[A-Z][A-Z])?$/)) { 524 request = "/cgi/geocoder.fcgi?postcode=" + encodeURIComponent(where) + "&callback=postcodeLoc&format=js"; 525 526 } else { 527 request = 'http://ws.geonames.org/searchJSON?name=' + encodeURIComponent(where) + '&callback=getLocation&country=GB&fclass=P&fclass=T&style=SHORT'; 528 } 516 529 aObj = new JSONscriptRequest(request); 517 530 // Build the script tag
Note: See TracChangeset
for help on using the changeset viewer.