NaviCodeGen

From Geohashing

ReadMe.txt

Geohash Wikimarkup Code Generator

file: geohash.asp
author:  Rammy M (aka  m5rammy)

purpose: (assumes you know what geohashing is)
generates wiki markup code for https://geohashing.site/ meetup pages,
so that you can easily get to meetup pages for neighboring graticules
and to other days of the same graticule.

parameters: none needed

set-up: put on any server that can run asp pages

optional set-up:
1) change the source-code, lines 8 and 9 to your own home lat & long
2) if you don't like the colors you can change them.

usage: should all be self-explanatory.
By default it picks the system date, but you can enter any date.
By default uses the "HomeLat" and "HomeLong" from the code, but you can enter any numbers.

known "issues":
- Does not handle the equator, meridian or anti-meridian. 
That means no "-0" and no going over "180" or under "-180"
- no error checking (it expects You to be smart enough)

planned updates (perhaps):
- fixing the known "issues"
- adding the option of picking which weekdays to show (currently there is only None, All, or Today)

Have fun, let me know if there are any problems ... on my user page, or find me ;-)

Also, if you do put these links on your meetup pages, think about putting them on the linked pages 
as well (re-generated with the appropriate numbers).  That is why I made it so that you can plug in
other lat/longs and not only use the hard-coded ones.

geohash.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><head><title>Geohash Wikimarkup Code Generator</title><%
' by m5rammy   User:M5rammy '
' last update  Sept 8th, 2008 '

' this is the only part you should need to change (optional) '

' store my home location '
Const HomeLat = "39" ' as a string, to handle -0 (not implemented yet) '
Const HomeLong = "-84"


' you can also change the default colors, if you want '
Dim bgc(4)
 bgc(1) = " bgcolor=""#FFFFCC""" ' lt yellow '
 bgc(2) = " bgcolor=""#CCFFFF""" ' lt blue '
 bgc(3) = " bgcolor=""#66FF99""" ' lt green '
 bgc(4) = " bgcolor=""#FFCCFF""" ' lt pink '


' That's it, no more changes needed '



' get the date '
SystemDate = Date

' functions '
'------------------------------------'
Function ChkIfSame(str1, str2)
  ret = ""
  If lcase(str1) = lcase(str2) Then ret = " checked=""checked"""
  ChkIfSame = ret
End Function
'------------------------------------'
Function TwoDig(n)
  '  assumes input is up to 31 '
  TwoDig = Mid(cStr(100 + n), 2)
End Function
'------------------------------------'
Function WikiDate(OneDate)
  WikiDate = Year(OneDate) & "-" & TwoDig(Month(OneDate)) & "-" & TwoDig(Day(OneDate))
End Function
'------------------------------------'
' get passed parameters '
myLat = Request.QueryString("lat")
myLong = Request.QueryString("long")
myDay = Request.QueryString("d")   ' assumes 2 digits '
myMonth = Request.QueryString("m") ' assumes 2 digits '
myYear = Request.QueryString("y")
myWeek = Request.QueryString("wkdys") ' may not match what we need '

If "" = myLat Then myLat = HomeLat
If "" = myLong Then mylong = HomeLong
If "" = myDay Then myDay = TwoDig(Day(SystemDate))
If "" = myMonth Then myMonth = TwoDig(Month(SystemDate))
If "" = myYear Then myYear = Year(SystemDate)

myMonthName = MonthName(myMonth)
myDate = myDay & "-" & myMonthName & "-" & Mid(myYear, 3)
myWikiDate = WikiDate(myDate)
myDayName = WeekdayName(Weekday(myDate), true, 0)

IsSat = (7 = Weekday(myDate))
PrevWk = ""
NextWk = ""
Select Case IsSat
  Case true
    ' Inner 1 '
    PrevSat = DateAdd("d", -7, myDate)
    NextSat = DateAdd("d", 7, myDate)
    Select case myWeek
      Case "prev" ' checking for valid input. Not the "best" way, but best for future enhancements '
        ' do nothing '
      Case "next"
        ' do nothing '
      Case "both"
        ' do nothing '
      Case Else
        myWeek = "none"
    End Select
    ' End Inner 1 '
  Case false
    PrevSat = DateAdd("d", -(Weekday(myDate)), myDate)
    NextSat = DateAdd("d", +(7-Weekday(myDate)), myDate)
    ' Inner 2 '
    Select case myWeek
      Case "all"
        ' do nothing '
      Case Else
        myWeek = "today"
    End Select
    ' End Inner 2 '
End Select

%></head><body>
Geohash Wikimarkup Code Generator - for graticule and date-navigation links
<form method="get"> For Location:
  Lat: <input type="text" name="lat" maxlength="4" size="5" value="<%=myLat %>"> Long: <input type="text" name="long" maxlength="4" size="5" value="<%=myLong %>">
For Date:
<td<%=bgc(1) %>><input type="radio" name="m" value="01"<%=ChkIfSame("01", TwoDig(myMonth)) %>>Jan <td<%=bgc(2) %>><input type="radio" name="m" value="02"<%=ChkIfSame("02", TwoDig(myMonth)) %>>Feb <td<%=bgc(1) %>><input type="radio" name="m" value="03"<%=ChkIfSame("03", TwoDig(myMonth)) %>>Mar <td<%=bgc(2) %>><input type="radio" name="m" value="04"<%=ChkIfSame("04", TwoDig(myMonth)) %>>Apr <td<%=bgc(1) %>><input type="radio" name="m" value="05"<%=ChkIfSame("05", TwoDig(myMonth)) %>>May <td<%=bgc(2) %>><input type="radio" name="m" value="06"<%=ChkIfSame("06", TwoDig(myMonth)) %>>Jun <td<%=bgc(1) %>><input type="radio" name="m" value="07"<%=ChkIfSame("07", TwoDig(myMonth)) %>>Jul <td<%=bgc(2) %>><input type="radio" name="m" value="08"<%=ChkIfSame("08", TwoDig(myMonth)) %>>Aug <td<%=bgc(1) %>><input type="radio" name="m" value="09"<%=ChkIfSame("09", TwoDig(myMonth)) %>>Sep <td<%=bgc(2) %>><input type="radio" name="m" value="10"<%=ChkIfSame("10", TwoDig(myMonth)) %>>Oct <td<%=bgc(1) %>><input type="radio" name="m" value="11"<%=ChkIfSame("11", TwoDig(myMonth)) %>>Nov <td<%=bgc(2) %>><input type="radio" name="m" value="12"<%=ChkIfSame("12", TwoDig(myMonth)) %>>Dec
  <input type="text" name="y" value="<%=MyYear %>" maxlength="4" size="5">
<% altBg = 1 ' to switch between 1 and 4 ' for r = 1 to 4 %> <% for d = ((r -1 ) * 10 + 1) to ((r - 1) * 10 + 9) step 2 %> <% if d < 32 then %><td<%=bgc(altBg) %>><input type="radio" name="d" value="<%=TwoDig(d) %>"<%=ChkIfSame(TwoDig(d), TwoDig(myDay)) %>><%=d %><% end if %> <% if d < 31 then %><td<%=bgc(5 - altBg) %>><input type="radio" name="d" value="<%=TwoDig(d + 1) %>"<%=ChkIfSame(TwoDig(d + 1), TwoDig(myDay)) %>><%=d+1 %><% end if %> <% next %> <% altBg = 5 - altBg next %>
 

  If Saturday Include Links to Daily Meetup pages for ...
  <input type="radio" name="wkdys" value="prev"<%=ChkIfSame(myWeek, "prev") %>>Previous week (Su-Fr)
  <input type="radio" name="wkdys" value="next"<%=ChkIfSame(myWeek, "next") %>>Next week (Su-Fr)
  <input type="radio" name="wkdys" value="both"<%=ChkIfSame(myWeek, "both") %>>Both weeks
  <input type="radio" name="wkdys" value="none"<%=ChkIfSame(myWeek, "none") %>>Neither week (default)
  If Weekday Include Links to Daily Meetup pages for ...
  <input type="radio" name="wkdys" value="today"<%=ChkIfSame(myWeek, "today") %>>Today only (default)
  <input type="radio" name="wkdys" value="all"<%=ChkIfSame(myWeek, "all") %>>All of this week
 
<input type="submit" value="Click to Generate the Code"> </form>
<% ' The Wiki Code ' %> <pre> {{meetup graticule | map=&lt;map lat="<%=myLat %>" lon="<%=myLong %>" date="<%=myWikiDate %>" /&gt; | lat=<%=myLat %> | lon=<%=myLong %> | date=<%=myWikiDate %> }} &lt;!-- see https://geohashing.site/geohashing/NaviCodeGen for script --&gt; {| border="1" style="text-align:center" |- | rowspan="3" | [[<%=WikiDate(PrevSat) & "_" & myLat & "_" & myLong %>|Prev Sat]]&lt;br><br><% If ("prev" = MyWeek) or ("both" = myWeek) or ("all" = MyWeek) Then Response.Write("[[" & WikiDate(DateAdd("d", 1, PrevSat)) & "_" & myLat & "_" & myLong & "|S]]") Response.Write("[[" & WikiDate(DateAdd("d", 2, PrevSat)) & "_" & myLat & "_" & myLong & "|M]]") Response.Write("[[" & WikiDate(DateAdd("d", 3, PrevSat)) & "_" & myLat & "_" & myLong & "|T]]") Response.Write("[[" & WikiDate(DateAdd("d", 4, PrevSat)) & "_" & myLat & "_" & myLong & "|W]]") Response.Write("[[" & WikiDate(DateAdd("d", 5, PrevSat)) & "_" & myLat & "_" & myLong & "|T]]") Response.Write("[[" & WikiDate(DateAdd("d", 6, PrevSat)) & "_" & myLat & "_" & myLong & "|F]]&lt;br><br>") End If If IsSat Then Response.Write("Today&lt;br><br>") If ("today" = MyWeek) Then Response.Write("[[" & myWikiDate & "_" & myLat & "_" & myLong & "|" & myDayName & "]]&lt;br><br>") If ("next" = MyWeek) or ("both" = myWeek) Then Response.Write("[[" & WikiDate(DateAdd("d", 8, PrevSat)) & "_" & myLat & "_" & myLong & "|S]]") Response.Write("[[" & WikiDate(DateAdd("d", 9, PrevSat)) & "_" & myLat & "_" & myLong & "|M]]") Response.Write("[[" & WikiDate(DateAdd("d", 10, PrevSat)) & "_" & myLat & "_" & myLong & "|T]]") Response.Write("[[" & WikiDate(DateAdd("d", 11, PrevSat)) & "_" & myLat & "_" & myLong & "|W]]") Response.Write("[[" & WikiDate(DateAdd("d", 12, PrevSat)) & "_" & myLat & "_" & myLong & "|T]]") Response.Write("[[" & WikiDate(DateAdd("d", 13, PrevSat)) & "_" & myLat & "_" & myLong & "|F]]&lt;br><br>") End If %>[[<%=WikiDate(NextSat) & "_" & myLat & "_" & myLong %>|Next Sat]] | rowspan="3" | Neighboring&lt;br&gt;<br>Meetups&lt;br&gt;<br>today &amp;rarr; | [[<%=myWikiDate & "_" & (myLat + 1) & "_" & (myLong - 1) %>|NW]] | [[<%=myWikiDate & "_" & (myLat + 1) & "_" & myLong %>|N]] | [[<%=myWikiDate & "_" & (myLat + 1) & "_" & (myLong + 1) %>|NE]] |- | [[<%=myWikiDate & "_" & myLat & "_" & (myLong - 1) %>|W]] | us | [[<%=myWikiDate & "_" & myLat & "_" & (myLong + 1) %>|E]] |- | [[<%=myWikiDate & "_" & (myLat - 1) & "_" & (myLong - 1) %>|SW]] | [[<%=myWikiDate & "_" & (myLat - 1) & "_" & myLong %>|S]] | [[<%=myWikiDate & "_" & (myLat - 1) & "_" & (myLong + 1) %>|SE]] |}

About

People

Comments

Achievements

Gallery

</pre> </body></html>