/yjg

ywesee javascript geolocation using geo.admin.ch

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

yjg - ywesee javascript geolocation

  1. Show button in HTML page.
  2. Show Option for user to enter Username.
  3. Click the button and grab long/lat with this library.
  4. Ask for permission to access GPS data on the mobile phone.
  5. User clicks the button to share location and his username (optional)
  6. Geolocation and Browser-ID is saved in the database.
  7. If the Geolocation changes more then 100 meters, the user can save his location again.
  8. Translate GPS coordinates into PLZ and Streetname.
  9. Output file updated daily at 7 am.

optional: configure locationiq.com

Get the map token from https://locationiq.com

  • copy settings.example.json to settings.json
  • add the token

settings.json

{
    "locationiqComId": "",
    "isSSL": false
}

Run

$ meteor npm i

$ meteor --settings settings.json

// with SSL support for localhost testing and selfsigned cert
$ meteor --settings settings.json --port 3100
// without SSL support or with Apache SSL support compiled in
$ meteor --settings settings.json --port 3000

Digital Ocean Deployment

Apache Setup

~$ cat /etc/apache2/sites-enabled/yjg.conf
<VirtualHost *:80>
  ServerName covgeo.ch
  Redirect permanent / https://covgeo.ch
</VirtualHost>

<VirtualHost 165.22.16.219:443>
  ServerName covgeo.ch
  ProxyPreserveHost On
  ProxyPass  /excluded !
  ProxyPass / http://127.0.0.1:3000/
  ProxyPassReverse / http://127.0.0.1:3000/
  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/live/covgeo.ch/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/covgeo.ch/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/covgeo.ch/chain.pem
</VirtualHost>

Apache will need these as well

a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html
a2enmod proxy
a2enmod ssl

Letsencrypt Setup

./certbot-auto certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns -d '*.covgeo.ch'  -d covgeo.ch

acme TXT Record setup

  1. Set acme Domain TXT records
  2. Test acme Setup dig -t TXT _acme-challenge.covgeo.ch