forked from hivewallet/coinmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d32dec4
Showing
7 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coinmap.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |