Difference between revisions of "User:Eupeodes/Geohashing Map/v1"

From Geohashing
imported>Eupeodes
(made more days optional)
imported>Eupeodes
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{30w compliant|yes=1}}
 
{{30w compliant|yes=1}}
 +
[[File:eupeodes_geohashing_map.png|right]]
  
http://gh.eupeodes.nl
+
http://v1.geohashing.info
  
 
==Why another one==
 
==Why another one==
 
None of the calculators really worked like I wanted, so I decided to write my own based on the google maps API V3 and geo.crox.
 
None of the calculators really worked like I wanted, so I decided to write my own based on the google maps API V3 and geo.crox.
 
 
==Supported platforms==
 
==Supported platforms==
 
* Desktop: (all?) modern browsers support on any OS
 
* Desktop: (all?) modern browsers support on any OS
* iPad: Works very well with multi touch
+
* iPad and iPhone: Works very well with multi touch. Update November 28, 2013: with a bookmark on the homescreen created since today the adresbar and toolbar are hidden, resulting a larger map on the screen.
 +
* Android: Works both in native browser and others
  
 
===Not tested===
 
===Not tested===
* Android: but for that there is geohashdroid
+
* Blackberry, Windows phone, others not listed above
* Smartphones of any type (but iPhone is expected to work just as good as iPad)
 
  
If anyone tests the app on any system, feel free to report if it works, either here (if it works) or on [[User_talk:Eupeodes/Geohashing_Map|the discussion page]] (with bug report).
+
If anyone tests the app on any system, feel free to report if it works, either here (if it works) or on [[User_talk:Eupeodes/Geohashing_Map|the discussion page]] (with bug report). Of course you can also join #geohashing on irc.foonetic.net
  
 
==Features==
 
==Features==
Line 20: Line 20:
 
** When no location is provided the map will center on the Netherlands
 
** When no location is provided the map will center on the Netherlands
 
* Shows hash in home graticule + 8 surrounding graticules
 
* Shows hash in home graticule + 8 surrounding graticules
* Download 1 or 9 hashes as gpx
+
* Download 1 hash or all visible hashes as gpx
 
* Select previous date, next date and today with buttons
 
* Select previous date, next date and today with buttons
 +
* When available not only the requested date but (optional) also a maximum of 6 days after that date is shown. Days are colored and the day of month is shown in the marker.
 +
** When more than one date is selected all show up in the gpx
 
* Display distance from home to hash in kilometers and miles
 
* Display distance from home to hash in kilometers and miles
* Clear popup message when hashes not yet available
+
* Clear message when hashes not yet available
* Link to the meetup on the wiki
+
* Link to:
 +
** the meetup on the wiki
 +
** google maps driving directions
 +
** Nearby geocaches
 +
** [[Implementations#Geohashing_Poster_Tool|Geohashing posters]]
 
* Display streetview
 
* Display streetview
* When available not only the requested date but (optional) also a maximum of 6 days after that date is shown. Days are colored and the day of month is shown in the marker.
 
 
* Display global hash
 
* Display global hash
 +
* Get permanent link from current view
 +
* Give name of location based on geonames.org
 +
* [[#Short url's|Short url's]]
 +
* Use a different center for the grid than home location (url parameters glat & glng define the centre of the grid)
 +
 +
===Broken features===
 +
* Send single hash to Garmin GPS device
  
 
==Planned features==
 
==Planned features==
* Implement send to gps (for at least Garmin, maybe more)
+
* Expand to 5x5 hashes?
Want another feature? Feel free to ask on [[User_talk:Eupeodes/Geohashing_Map|the discussion page]]. I don't promise I will do something with it, but I can take it into consideration.
+
Want another feature? Feel free to ask on [[User_talk:Eupeodes/Geohashing_Map|the discussion page]]. I don't promise I will do something with it, but I can take it into consideration. New features can also be discussed on #geohashing on irc.foonetic.net
  
 
==Usage==  
 
==Usage==  
 
Parameters:
 
Parameters:
* lat - latitude of the initial graticule
+
* lat - latitude of the home position
* lon - longitude of the initial graticule
+
* lon or lng - longitude of the home position
 
* date - initial date in YYYY-MM-DD format
 
* date - initial date in YYYY-MM-DD format
 +
* type - maptype, this has the following options:
 +
** map - Roadmap
 +
** sat - Satellite
 +
** hyb - Hybrid roadmap/satellite (default)
 +
** ter - terrain
 +
* zoom - zoom level of the map
 +
* clat & clng - where to center the map
 +
* glat & glng - center graticule of the grid
 +
* multi - false to show only a single day
 +
 +
e.g: http://v1.geohashing.info/?date=2005-05-26&lat=37&lon=-122
 +
 +
===Short url's===
 +
 +
There are also short url's available, the format of these url's is
 +
 +
http://v1.geohashing.info[/type][/date[/single][/home[/zoom[/center]]]
 +
 +
* type is one the types as above
 +
* date is date in YYYY-MM-DD or YYYYMMDD format
 +
* single is indicator for multi, 's' to show single day, otherwise leave out
 +
* home is [http://geohash.org geohash] of the home location or 'global' to display the global
 +
* zoom is zoom level of the map
 +
* center is [http://geohash.org geohash] of center of the map
  
e.g: http://gh.eupeodes.nl?date=2005-05-26&lat=37&lon=-122
+
==Code==
 +
Below is the function that calculates the decimal part of the hash
 +
{{User:Eupeodes/Geohashing_Map/code}}
 +
[[Category:Eupeodes]]
 +
[[ Category:Implementations]]

Latest revision as of 09:13, 3 January 2016

This implementation IS FULLY 30W-compliant.
Eupeodes geohashing map.png

http://v1.geohashing.info

Why another one

None of the calculators really worked like I wanted, so I decided to write my own based on the google maps API V3 and geo.crox.

Supported platforms

  • Desktop: (all?) modern browsers support on any OS
  • iPad and iPhone: Works very well with multi touch. Update November 28, 2013: with a bookmark on the homescreen created since today the adresbar and toolbar are hidden, resulting a larger map on the screen.
  • Android: Works both in native browser and others

Not tested

  • Blackberry, Windows phone, others not listed above

If anyone tests the app on any system, feel free to report if it works, either here (if it works) or on the discussion page (with bug report). Of course you can also join #geohashing on irc.foonetic.net

Features

  • Uses geolocation to determine location, also possible to provide url parameters or store home in a cookie
    • When no location is provided the map will center on the Netherlands
  • Shows hash in home graticule + 8 surrounding graticules
  • Download 1 hash or all visible hashes as gpx
  • Select previous date, next date and today with buttons
  • When available not only the requested date but (optional) also a maximum of 6 days after that date is shown. Days are colored and the day of month is shown in the marker.
    • When more than one date is selected all show up in the gpx
  • Display distance from home to hash in kilometers and miles
  • Clear message when hashes not yet available
  • Link to:
  • Display streetview
  • Display global hash
  • Get permanent link from current view
  • Give name of location based on geonames.org
  • Short url's
  • Use a different center for the grid than home location (url parameters glat & glng define the centre of the grid)

Broken features

  • Send single hash to Garmin GPS device

Planned features

  • Expand to 5x5 hashes?

Want another feature? Feel free to ask on the discussion page. I don't promise I will do something with it, but I can take it into consideration. New features can also be discussed on #geohashing on irc.foonetic.net

Usage

Parameters:

  • lat - latitude of the home position
  • lon or lng - longitude of the home position
  • date - initial date in YYYY-MM-DD format
  • type - maptype, this has the following options:
    • map - Roadmap
    • sat - Satellite
    • hyb - Hybrid roadmap/satellite (default)
    • ter - terrain
  • zoom - zoom level of the map
  • clat & clng - where to center the map
  • glat & glng - center graticule of the grid
  • multi - false to show only a single day

e.g: http://v1.geohashing.info/?date=2005-05-26&lat=37&lon=-122

Short url's

There are also short url's available, the format of these url's is

http://v1.geohashing.info[/type][/date[/single][/home[/zoom[/center]]]
  • type is one the types as above
  • date is date in YYYY-MM-DD or YYYYMMDD format
  • single is indicator for multi, 's' to show single day, otherwise leave out
  • home is geohash of the home location or 'global' to display the global
  • zoom is zoom level of the map
  • center is geohash of center of the map

Code

Below is the function that calculates the decimal part of the hash

<?php
class calc {
   public function doCalc($date, $dow){
       $md5 = md5($date."-".$dow);
       list($lat,$lng) = str_split($md5,16);
       return array($this->hex2dec($lat), $this->hex2dec($lng));
   }

   private function hex2dec($var){
       $o = 0;
       for($i=0;$i<16;$i++){
           $o += hexdec($var[$i])*pow(16,-$i-1);
       }
       return $o;
   }
}
?>

usage:

<?php
$calc = new calc();
list($lat, $lng) = $calc->doCalc($date, $dow);
?>
  • for $date the date of the hash should be filled in in the format yyyy-mm-dd
  • for $dow the dow that should be used should be filled in with a dot as decimal sign.