4 import random_points_bbox
6 def test_compare(strUrl1, strUrl2, iPoints):
7 #define bounding box for test
8 # sw: left-lower corner
14 #first get some random points in the bbox
15 aPoints = random_points_bbox.getPoints(iPoints, -100.815, 46.789, -100.717, 46.84)
19 missing_housenumber_1=0
20 missing_housenumber_2=0
22 response = url.urlopen( strUrl1 % (point[1],point[0]))
23 data1 = json.load(response)
24 response = url.urlopen(strUrl2 % (point[1],point[0]))
25 data2 = json.load(response)
26 if data1['address'] == data2['address']:
28 elif 'road' in data1['address'] and 'road' in data2['address']:
30 print 'different: '+str(data1['address'])+' - ' + str(data2['address'])
31 if data1['address']['road'] != data2['address']['road']:
33 if 'house_number' not in data1['address']:
34 missing_housenumber_1 +=1
35 print 'missing housenumber in Line: '+str(data1['address'])
36 if 'house_number' not in data2['address']:
37 missing_housenumber_2 +=1
38 print 'missing housenumber in Old: '+str(data2['address'])
41 print 'Number of same values: '+str(same)
42 print 'Number of different values: '+str(differ)
43 print 'Number of different streets: '+str(differ_street)
44 print 'Points without housenumber in Line: '+str(missing_housenumber_1)
45 print 'Points without housenumber in Old: '+str(missing_housenumber_2)
46 strUrlLine = "http://localhost/nominatim/reverse.php?format=json&lat=%f&lon=%f"
47 strUrlOld = "http://localhost/nominatim_old/reverse.php?format=json&lat=%f&lon=%f"
49 test_compare(strUrlLine,strUrlOld, 100)