@@ -68,7 +68,7 @@ territoryAlphaCode | string, full territory alphacode
6868
6969The most widely used routine to generate mapcodes is probably:
7070
71- encodeShortest (lat, lon, territory)
71+ encodeShortest(lat, lon, territory)
7272
7373parameter | description
7474--- | ---
@@ -84,14 +84,15 @@ sometimes called the “default mapcode” for a particular territory.
8484Example Javascript:
8585
8686 function displayMapcodes(e) {
87- document.write('<u>',e.length,' result(s)</u><br>');
88- for(var i=0;i<e.length;i++) {
89- if ( e[i].territoryAlphaCode != "AAA" )
90- document.write(e[i].territoryAlphaCode,' ');
91- document.write('<b>',e[i].mapcode,'</b><br>');
87+ document.write('<u>',e.length,' result(s)</u><br/>');
88+ for(var i = 0; i < e.length; i++) {
89+ if (e[i].territoryAlphaCode != "AAA") {
90+ document.write(e[i].territoryAlphaCode, ' ');
91+ }
92+ document.write('<b>', e[i].mapcode, '</b><br/>');
9293 }
9394 }
94- displayMapcodes( encodeShortest( 34.00956,-118.210572, 'US-CA' ) );
95+ displayMapcodes(encodeShortest(34.00956, -118.210572, 'US-CA') );
9596
9697Output:
9798
@@ -106,7 +107,7 @@ Since any coordinate is somewhere on the world, this routine is guaranteed to de
106107
107108Example Javascript:
108109
109- var e = encodeShortest( 34.00956,-118.210572 );
110+ var e = encodeShortest(34.00956, -118.210572);
110111
111112Output using displayMapcodes(e):
112113
@@ -133,7 +134,7 @@ will simply yield all mapcodes that can represent the coordinate.
133134
134135Example Javascript:
135136
136- var e = encode( 36.115, -115.1731, 'US-NV' );
137+ var e = encode(36.115, -115.1731, 'US-NV');
137138
138139Output using ` displayMapcodes(e) ` :
139140
@@ -150,7 +151,7 @@ country share. Of course, the shortest mapcode is preferred in almost every circ
150151
151152Example Javascript:
152153
153- var e = encode( 36.115, -115.1731 );
154+ var e = encode(36.115, -115.1731);
154155
155156Output using ` displayMapcodes(e) ` :
156157
@@ -173,7 +174,7 @@ mapcodes correctly represent the original coordinate.
173174
174175For very specific applications, the following routine only returns the international mapcode
175176
176- encodeInternational (lat, lon)
177+ encodeInternational(lat, lon)
177178
178179returns an array with exactly one result: the 9-letter international mapcode representing
179180the coordinate.
@@ -215,8 +216,8 @@ This routine is sufficient to decode a full mapcodeString into a coordinate.
215216
216217Example Javascript:
217218
218- var result = decode( 'NLD 49.4V' );
219- document.write( result.y + ',' + result.x + '<BR>' );
219+ var result = decode('NLD 49.4V');
220+ document.write(result.y + ',' + result.x + '<br/>' );
220221
221222Output:
222223
@@ -247,14 +248,14 @@ Example Javascript:
247248 var defaultcontext = 'IN-DL';
248249
249250 var result;
250- result = decode( 'US-AR 49.4V', defaultcontext );
251- document.write( result.y + ',' + result.x + '<BR>' );
252- result = decode( 'AR 49.4V', defaultcontext );
253- document.write( result.y + ',' + result.x + '<BR>' );
254- result = decode( '49.4V', defaultcontext );
255- document.write( result.y + ',' + result.x + '<BR>' );
256- result = decode( 'xxx.xxxx', defaultcontext );
257- document.write( result.y + ',' + result.x + '<BR>' );
251+ result = decode('US-AR 49.4V', defaultcontext);
252+ document.write(result.y + ',' + result.x + '<br/>' );
253+ result = decode('AR 49.4V', defaultcontext);
254+ document.write(result.y + ',' + result.x + '<br/>' );
255+ result = decode('49.4V', defaultcontext);
256+ document.write(result.y + ',' + result.x + '<br/>' );
257+ result = decode('xxx.xxxx', defaultcontext);
258+ document.write(result.y + ',' + result.x + '<br/>' );
258259
259260Output:
260261
@@ -344,8 +345,8 @@ return value | a string
344345
345346Example Javascript:
346347
347- document.write(convertToAlphabetAsHTML( ‘PQ.RS’, 4 ) ,’<br>’)
348- document.write(convertToAlphabetAsHTML( ‘PQ.RS’, 2 ) ,’<br>’)
348+ document.write(convertToAlphabetAsHTML(‘PQ.RS’, 4) ,’<br/ >’)
349+ document.write(convertToAlphabetAsHTML(‘PQ.RS’, 2) ,’<br/ >’)
349350
350351Output:
351352
0 commit comments