Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak committed Apr 13, 2013
0 parents commit d32dec4
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coinmap.txt
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CoinMap
=======

Simple OpenStreetMap mashup that shows places where Bitcoin is accepted.

Donations welcome at 1HGub51H32YhUFw4zysMoTazBs88kWJJud
Binary file added bitcoin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions coinmap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function coinmap() {
var map = new OpenLayers.Map('map', {
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
numZoomLevels: 19,
maxResolution: 156543.0399,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
});

var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
map.addLayers([layerMapnik]);

var bitcoin = new OpenLayers.Layer.Text("Bitcoin", { location: "coinmap.txt", projection: map.displayProjection });
map.addLayer(bitcoin);

map.removeControl(map.controls[1]); // remove simple zoom buttons
map.addControl(new OpenLayers.Control.PanZoomBar());

var lonLat = new OpenLayers.LonLat(0,0).transform(map.displayProjection, map.projection);
map.setCenter(lonLat, 0);
}
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="bitcoin.png" />
<title>CoinMap</title>
<meta name="bitcoin" content="1HGub51H32YhUFw4zysMoTazBs88kWJJud" />
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
<script src="coinmap.js"></script>
</head>
<body onload="coinmap()">
<div id="logo">CoinMap</div>
<div id="map"></div>
<div id="footer1">If you don't see your place here, head to <a href="http://www.openstreetmap.org/edit">OpenStreetMap editor</a> and add <strong>payment:bitcoin=yes</strong> tag to your venue.</div>
<div id="footer2">Donations are welcome at <a href="bitcoin:1HGub51H32YhUFw4zysMoTazBs88kWJJud">1HGub51H32YhUFw4zysMoTazBs88kWJJud</a></div>
</body>
</html>
43 changes: 43 additions & 0 deletions refresh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/python
import urllib
import urllib2
from lxml import etree

data = {'data': '<query type="node"><has-kv k="payment:bitcoin" v="yes"/></query><print/>'}
req = urllib2.Request('http://www.overpass-api.de/api/interpreter', urllib.urlencode(data))
f = urllib2.urlopen(req)
tree = etree.parse(f)
f.close()

with open('coinmap.txt', 'w') as f:
f.write('lat\tlon\ttitle\tdescription\ticonSize\ticonOffset\ticon\n')
for e in tree.findall('node'):
lat = e.get('lat')
lon = e.get('lon')
tags = {}
for i in list(e):
tags[i.get('k')] = i.get('v')
if 'name' in tags:
title = tags['name']
else:
title = 'node#%d' % i.get('id')
desc = ''
desc += '%s %s<br/>' % (tags.get('addr:street', ''), tags.get('addr:housenumber', ''))
desc += '%s %s<br/>' % (tags.get('addr:postcode', ''), tags.get('addr:city', ''))
desc += '%s<br/>' % (tags.get('addr:country', ''))
if 'website' in tags:
desc += '<a href="%s">%s</a>' % (tags['website'], tags['website'])
f.write(lat)
f.write('\t')
f.write(lon)
f.write('\t')
f.write(title.encode('utf-8'))
f.write('\t')
f.write(desc.encode('utf-8'))
f.write('\t')
f.write('24,24') # iconSize
f.write('\t')
f.write('-12,-12') # iconOffset
f.write('\t')
f.write('bitcoin.png') #icon
f.write('\n')
47 changes: 47 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
body {
border: 0px;
margin: 0px;
padding: 0px;
}

#map {
left: 0px;
top: 0px;
position: absolute;
width: 100%;
height: 100%;
z-index: 0;
}

#logo {
right: 10px;
top: 10px;
position: absolute;
z-index: 1;
font-size: xx-large;
font-style: italic;
}

#footer1 {
left: 3px;
bottom: 4.5em;
position: absolute;
z-index: 1;
font-size: smaller;
}

#footer2 {
left: 3px;
bottom: 3em;
position: absolute;
z-index: 1;
font-size: smaller;
}

a {
color: blue;
}

.olPopup {
border: 1px solid black;
}

0 comments on commit d32dec4

Please sign in to comment.