Browse Source

Upload

master
grisu48 4 years ago
parent
commit
84ac293b65
  1. 214
      CampingCard.is_Locations.gpx
  2. 1
      CampingCard.is_Locations.json
  3. 14
      LICENSE
  4. 16
      README.md
  5. 81
      fetch_campingcard_gpx.py

214
CampingCard.is_Locations.gpx

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0">
<name>Example gpx</name>
<wpt lat="66.4520211" lon="-15.9644089">
<name>Raufarhöfn</name>
<desc>nearby Skólabraut<br/>675 Raufarhöfn<br/><br/>Open between<br/>1. Juni –15. September<br/></desc>
<url>https://www.campingcard.is/raufarhofn/</url>
</wpt>
<wpt lat="66.301255" lon="-16.442767">
<name>Kópasker</name>
<desc>Austurtröð 4<br/>670 Kópasker<br/><br/>Open between<br/>1. June - 15. September<br/></desc>
<url>https://www.campingcard.is/kopasker/</url>
</wpt>
<wpt lat="64.038935" lon="-22.696766">
<name>SANDGERÐI</name>
<desc>Byggðarvegi<br/>245 Sandgerði<br/><br/>Open between<br/>1. April–30. September.<br/></desc>
<url>https://www.campingcard.is/sandgerdi/</url>
</wpt>
<wpt lat="63.843147" lon="-22.420415">
<name>GRINDAVÍK</name>
<desc>Austurvegur<br/>240 Grindavík<br/><br/>Open between<br/>15. May–30. September<br/></desc>
<url>https://www.campingcard.is/grindavik/</url>
</wpt>
<wpt lat="63.841402" lon="-21.554339">
<name>T-BÆR</name>
<desc>T-bær, Selvogi<br/>815 Þorlákshöfn<br/><br/>Open between<br/>1. May –30. September<br/></desc>
<url>https://www.campingcard.is/t-baer/</url>
</wpt>
<wpt lat="63.852875" lon="-21.383638">
<name>ÞORLÁKSHÖFN</name>
<desc>Hafnarberg 41 (by the sports center)<br/>815 Þorlákshöfn<br/><br/>Open between<br/>15. May –1. September<br/></desc>
<url>https://www.campingcard.is/thorlakshofn/</url>
</wpt>
<wpt lat="63.835315" lon="-21.056631">
<name>STOKKSEYRI</name>
<desc>Sólvellir<br/>825 Stokkseyri<br/><br/>Open between<br/>1. May –1. October<br/></desc>
<url>https://www.campingcard.is/stokkseyri/</url>
</wpt>
<wpt lat="64.087282" lon="-20.431266">
<name>ÁLFASKEIÐ</name>
<desc>Syðra Langholti<br/>845 Flúðum<br/><br/>Open between<br/>1. June–1. September<br/></desc>
<url>https://www.campingcard.is/alfaskeid/</url>
</wpt>
<wpt lat="64.025015" lon="-20.51278">
<name>BRAUTARHOLT</name>
<desc>Brautarholti á Skeiðum (Skeiða- og Gnúpverjahreppi)<br/>801 Selfossi<br/><br/>Open between<br/>10. June– 15. September<br/></desc>
<url>https://www.campingcard.is/brautarholt/</url>
</wpt>
<wpt lat="63.726933" lon="-19.985665">
<name>LANGBRÓK</name>
<desc>Fljótshlíð<br/>861 Hvolsvöllur<br/><br/>Open between<br/>1. May –1. October<br/></desc>
<url>https://www.campingcard.is/langbrok/</url>
</wpt>
<wpt lat="63.800155" lon="-18.0847966">
<name>KLEIFARMÖRK</name>
<desc>Kleifar-Mörk<br/>880 Kirkjubæjarklaustur<br/><br/>Open between<br/>1. June –31. August<br/></desc>
<url>https://www.campingcard.is/kleifarmork/</url>
</wpt>
<wpt lat="64.832313" lon="-13.861504">
<name>STÖÐVARFJÖRÐUR</name>
<desc>Fjarðarbraut<br/>755 Stöðvarfirði<br/><br/>Open between<br/>1 June – 15 September<br/></desc>
<url>https://www.campingcard.is/stodvarfjordur/</url>
</wpt>
<wpt lat="64.936661" lon="-14.036721">
<name>FÁSKRÚÐSFJÖRÐUR</name>
<desc>Óseyri<br/>750 Fáskrúðsfirði<br/><br/>Open between<br/>1 June – 15 September<br/></desc>
<url>https://www.campingcard.is/faskrudsfjordur/</url>
</wpt>
<wpt lat="65.034372" lon="-14.241071">
<name>REYÐARFJÖRÐUR</name>
<desc>Búðareyri<br/>730 Reyðarfirði<br/><br/>Open between<br/>1 May – 15 September<br/></desc>
<url>https://www.campingcard.is/reydarfjordur/</url>
</wpt>
<wpt lat="65.1497396" lon="-13.6822644">
<name>NORÐFJÖRÐUR</name>
<desc>Víðimýri<br/>740 Neskaupstað<br/><br/>Open between<br/>1 June – 15 September<br/></desc>
<url>https://www.campingcard.is/nordfjordur/</url>
</wpt>
<wpt lat="65.260433" lon="-14.010626">
<name>SEYÐISFJÖRÐUR</name>
<desc>Ránargata 5<br/>710 Seyðisfjörður<br/><br/>Open between<br/>1. May –30. September<br/></desc>
<url>https://www.campingcard.is/seydisfjordur/</url>
</wpt>
<wpt lat="66.201023" lon="-15.33838">
<name>ÞÓRSHÖFN</name>
<desc>Miðholt<br/>680 Þórshöfn<br/><br/>Open between<br/>1.June –31. August<br/></desc>
<url>https://www.campingcard.is/thorshofn/</url>
</wpt>
<wpt lat="65.374641" lon="-15.884409">
<name>FJALLADÝRÐ</name>
<desc>Möðrudalur<br/>601 Mývatn<br/><br/>Open between<br/>20. May –10 September<br/></desc>
<url>https://www.campingcard.is/fjalladyrd/</url>
</wpt>
<wpt lat="65.88925" lon="-17.320383">
<name>HEIÐARBÆR</name>
<desc>Heiðarbær Reykjahverfi<br/>641 Húsavík<br/><br/>Open between<br/>1. June –10. September<br/></desc>
<url>https://www.campingcard.is/heidarbaer/</url>
</wpt>
<wpt lat="65.6983991" lon="-17.9701233">
<name>Lónsá</name>
<desc>Lónsá<br/>601 Akureyri<br/><br/>Open between<br/>31 May – 15 September<br/></desc>
<url>https://www.campingcard.is/lonsa/</url>
</wpt>
<wpt lat="65.923789" lon="-18.568142">
<name>Húsabakki</name>
<desc>Húsabakki, Svarfaðardal<br/>620 Dalvík<br/><br/>Open between<br/>May - September (until the first snow)<br/></desc>
<url>https://www.campingcard.is/husabakki/</url>
</wpt>
<wpt lat="66.071186" lon="-18.648932">
<name>ÓLAFSFJÖRÐUR</name>
<desc>Gránugötu 24<br/>580 Siglufjörður<br/><br/>Open between<br/>15. May –15. October<br/></desc>
<url>https://www.campingcard.is/olafsfjordur/</url>
</wpt>
<wpt lat="66.15009" lon="-18.908801">
<name>SIGLUFJÖRÐUR</name>
<desc>Gránugötu 24<br/>580 Siglufjörður<br/><br/>Open between<br/>15. May – 15 October<br/></desc>
<url>https://www.campingcard.is/siglufjordur-2/</url>
</wpt>
<wpt lat="65.748487" lon="-19.647798">
<name>SAUÐÁRKRÓKUR</name>
<desc>Sauðárkrókur<br/>550 Sauðárkróki<br/><br/>Open between<br/>15 May - 15 September<br/></desc>
<url>https://www.campingcard.is/saudarkrokur/</url>
</wpt>
<wpt lat="65.824945" lon="-20.294587">
<name>SKAGASTRÖND</name>
<desc>Hólabraut 35<br/>545 Skagaströnd<br/><br/>Open between<br/>1 June – 10 September<br/></desc>
<url>https://www.campingcard.is/skagastrond/</url>
</wpt>
<wpt lat="65.402297" lon="-20.9295">
<name>HVAMMSTANGI</name>
<desc>Kirkjuhvammur<br/>530 Hvammstangi<br/><br/>Open between<br/>15 May –15 October<br/></desc>
<url>https://www.campingcard.is/hvammstangi/</url>
</wpt>
<wpt lat="65.69167" lon="-21.439256">
<name>DRANGSNES</name>
<desc>Drangsnes<br/>520 Drangsnes<br/><br/>Open between<br/>1 June - 31 August<br/></desc>
<url>https://www.campingcard.is/drangsnes/</url>
</wpt>
<wpt lat="66.06092" lon="-23.199073">
<name>TUNGUDALUR</name>
<desc>Tungudalur<br/>400 Ísafirði<br/><br/>Open between<br/>15 May - 15 September<br/></desc>
<url>https://www.campingcard.is/tungudalur/</url>
</wpt>
<wpt lat="66.155042" lon="-23.253304">
<name>BOLUNGARVÍK</name>
<desc>Bolungarvík, by the Swimmingpool<br/>415 Bolungarvík<br/><br/>Open between<br/>1 June –30 September<br/></desc>
<url>https://www.campingcard.is/bolungarvik/</url>
</wpt>
<wpt lat="65.879747" lon="-23.493857">
<name>Þingeyri</name>
<desc>Tjaldsvæði Þingeyrarodda<br/>470 Þingeyri<br/><br/>Open between<br/>15 May –15 September<br/></desc>
<url>https://www.campingcard.is/thingeyri/</url>
</wpt>
<wpt lat="65.636543" lon="-23.863202">
<name>TÁLKNAFJÖRÐUR</name>
<desc>Sveinseyri<br/>460 Tálknafjörður<br/><br/>Open between<br/>1 June – 1 September<br/></desc>
<url>https://www.campingcard.is/talknafjordur/</url>
</wpt>
<wpt lat="65.577382" lon="-23.172655">
<name>FLÓKALUNDUR</name>
<desc>Vatnsfjörður<br/>451 Patreksfjörður<br/><br/>Open between<br/>1. júní–10. september<br/></desc>
<url>https://www.campingcard.is/flokalundur/</url>
</wpt>
<wpt lat="65.44628" lon="-22.20206">
<name>REYKHÓLAHREPPUR</name>
<desc>Grettislaug á Reykhólum<br/>380 Reykhólahreppur<br/><br/>Open between<br/>1 June –31 August<br/></desc>
<url>https://www.campingcard.is/reykholahreppur/</url>
</wpt>
<wpt lat="65.246232" lon="-21.804514">
<name>Laugar</name>
<desc>Laugar<br/>371 Búðardalur<br/><br/>Open between<br/>2 June – 27 August<br/></desc>
<url>https://www.campingcard.is/laugar/</url>
</wpt>
<wpt lat="64.914646" lon="-23.886148">
<name>Hellissandur</name>
<desc>Hellissandur<br/>360 Hellissandi<br/><br/>Open between<br/>15 May – 15 September<br/></desc>
<url>https://www.campingcard.is/hellissandur/</url>
</wpt>
<wpt lat="64.687899" lon="-21.588642">
<name>Varmaland</name>
<desc>Varmaland<br/>311 Borgarnes<br/><br/>Open between<br/>1 June - 31 August<br/></desc>
<url>https://www.campingcard.is/varmaland/</url>
</wpt>
<wpt lat="64.304558" lon="-20.199866">
<name>Skjól</name>
<desc>Kjóastaðir<br/>801 Geysir<br/><br/>Open between<br/>1 May - 15 September<br/></desc>
<url>https://www.campingcard.is/skjol/</url>
</wpt>
<wpt lat="64.814927" lon="-22.412067">
<name>Eldborg</name>
<desc>Laugargerðisskóli<br/>311Borgarnes<br/><br/>Open between<br/>20 May – 20 August<br/></desc>
<url>https://www.campingcard.is/eldborg/</url>
</wpt>
<wpt lat="64.89129199706353" lon="-23.69499921798706">
<name>Ólafsvík</name>
<desc>Ólafsvík<br/>355 Ólafsvík<br/><br/>Open between<br/>15 May – 15 September<br/></desc>
<url>https://www.campingcard.is/olafsvik/</url>
</wpt>
<wpt lat="65.0718588" lon="-14.0164948">
<name>Eskifjörður</name>
<desc>Strandgata<br/>735 Eskifjörður<br/><br/>Open between<br/>1 June – 15 September<br/></desc>
<url>https://www.campingcard.is/eskifjordur/</url>
</wpt>
<wpt lat="63.4192833" lon="-18.9956188">
<name>Vík í Mýrdal</name>
<desc>Klettsvegur 7<br/>870 Vík í Mýrdal<br/><br/>Open between<br/>1 June - 15 September<br/></desc>
<url>https://www.campingcard.is/vik-i-myrdal/</url>
</wpt>
<wpt lat="64.326068" lon="-22.067509">
<name>Akranes</name>
<desc>Kalmansbraut<br/>300 Akranes<br/><br/>Open between<br/>5 May - 1 October<br/></desc>
<url>https://www.campingcard.is/akranes/</url>
</wpt>
</gpx>

1
CampingCard.is_Locations.json

File diff suppressed because one or more lines are too long

14
LICENSE

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2017 Felix Niederwanger <felix@feldspaten.org>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

16
README.md

@ -1,2 +1,16 @@
# Iceland-CampingCard-Locations
Python script to extract the locations of the CampingCard.is to a GPX file
This is a simple python script to extract the locations of the CampingCard.is to a GPX file.
The provided GPX file is valid for 2017 and was used by an Iceland trip.
Use at own risk and verify before you use it!
https://www.campingcard.is/
## Usage
./fetch_campingcard_gpx.py >CampingCard.is_Locations.gpx
This will run the script and writes the GPX file to `CampingCard.is_Locations.gpx`

81
fetch_campingcard_gpx.py

@ -0,0 +1,81 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
import requests
if __name__ == "__main__" :
# Download
r = requests.get('https://www.campingcard.is/')
if r.status_code != 200 : raise ValueError("Http status code " + str(r.status_code))
html = str(r.text)
objs = None
try :
map_objects = html[html.find('var tjaldsvaedi_markers'):]
map_objects = map_objects.split('\n')
map_objects = map_objects[1]
text = '[' + map_objects.strip()[:-1] + ']'
# Fix broken json
def fix_json(text, value) :
key = value + ":"
ret = text.replace(key, '"' + value + '":')
return ret
text = text.replace("'", '"')
text = fix_json(text, "position")
text = fix_json(text, "lng")
text = fix_json(text, "lat")
text = fix_json(text, "map")
text = fix_json(text, "title")
text = fix_json(text, "url")
text = fix_json(text, "categories")
text = fix_json(text, "description")
text = text.replace(', "map": map', '')
with open('CampingCard.is_Locations.json', 'w') as f_out :
f_out.write(text)
f_out.write('\n')
objs = json.loads(text)
except Exception as e:
sys.stderr.write("Error parsing: " + str(e) + "\n")
sys.exit(1)
# Print GPX file
print(
'''<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0">
<name>Example gpx</name>''')
# <wpt lat="46.57638889" lon="8.89263889">
# <ele>2372</ele>
# <name>LAGORETICO</name>
# </wpt>
for i in objs :
try :
title = i['title']
pos = i['position']
lat = float(pos['lat'])
lon = float(pos['lng'])
url = i['url']
desc = i['description']
cat =i['categories']
#print(title,lat,lon,desc, cat)
print(' <wpt lat="' + str(lat) + '" lon="' + str(lon) + '">')
print(' <name>' + str(title) + '</name>')
print(' <desc>' + str(desc) + '</desc>')
print(' <url>' + str(url) + '</url>')
print(' </wpt>')
except Exception as e :
sys.stderr.write("Error parsing element " + str(i) + "\n")
print('</gpx>')
Loading…
Cancel
Save