mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-27 23:15:12 +03:00
Removed some files for the commit.
This commit is contained in:
parent
df6b433066
commit
6fb8fab665
@ -1,43 +0,0 @@
|
||||
import numpy as np
|
||||
import urllib2 as url
|
||||
import json as json
|
||||
import random_points_bbox
|
||||
import time
|
||||
|
||||
def test(num):
|
||||
#first get some random points in the bbox
|
||||
aPoints = random_points_bbox.getPoints(num, -100.815, 46.789, -100.717, 46.84)
|
||||
#get the addresses
|
||||
sReverseUrl = "http://localhost/nominatim/reverse.php?format=json&lat=%f&lon=%f"
|
||||
aAddresses = []
|
||||
for point in aPoints:
|
||||
response = url.urlopen(sReverseUrl % (point[1], point[0]))
|
||||
aAddresses.append(json.load(response)['address'])
|
||||
#print aAddresses
|
||||
# now we have all the addresses of the points in a list
|
||||
# lets forward geocode this list
|
||||
sOldUrl = "http://localhost/nominatim_old/search.php?format=json&city=%s&street=%s&addressdetails=1"
|
||||
sLineUrl = "http://localhost/nominatim/search.php?format=json&city=%s&street=%s&addressdetails=1"
|
||||
diff_lat =0
|
||||
diff_lon =0
|
||||
points =0
|
||||
for address in aAddresses:
|
||||
if 'house_number' in address and 'road' in address:
|
||||
responseOld = url.urlopen(sOldUrl % (address['city'], address['house_number']+' '+address['road']))
|
||||
dataOld = json.load(responseOld)
|
||||
print dataOld[0]['display_name']
|
||||
responseLine = url.urlopen(sLineUrl % (address['city'], address['house_number']+' '+address['road']))
|
||||
dataLine = json.load(responseLine)
|
||||
print dataLine[0]['display_name']
|
||||
temp_diff_lat = np.abs(float(dataOld[0]['lat'])-float(dataLine[0]['lat']))
|
||||
temp_diff_lon = np.abs(float(dataOld[0]['lon'])-float(dataLine[0]['lon']))
|
||||
print "diff lat: "+str(temp_diff_lat*111166)+", diff lon: "+str(temp_diff_lon*250456)
|
||||
diff_lat += temp_diff_lat
|
||||
diff_lon += temp_diff_lon
|
||||
points +=1
|
||||
|
||||
print "Average difference in lat degrees with %d elements: %f (meters: %f)" % (points, diff_lat/points, diff_lat/points*111166)
|
||||
print "Average difference in lon degrees with %d elements: %f (meters: %f)" % (points, diff_lon/points, diff_lon/points*250456)
|
||||
# at 46.8 deg: 1 deg lat=111.166, 1 deg lon=250.456
|
||||
|
||||
test(20)
|
@ -1,45 +0,0 @@
|
||||
import numpy as np
|
||||
import urllib2 as url
|
||||
import json as json
|
||||
import random_points_bbox
|
||||
import time
|
||||
|
||||
def test(num):
|
||||
#first get some random points in the bbox
|
||||
aPoints = random_points_bbox.getPoints(num, -100.815, 46.789, -100.717, 46.84)
|
||||
#get the addresses
|
||||
sReverseUrl = "http://localhost/nominatim_old/reverse.php?format=json&lat=%f&lon=%f"
|
||||
aAddresses = []
|
||||
for point in aPoints:
|
||||
response = url.urlopen(sReverseUrl % (point[1], point[0]))
|
||||
aAddresses.append(json.load(response)['address'])
|
||||
#print aAddresses
|
||||
# now we have all the addresses of the points in a list
|
||||
# lets forward geocode this list
|
||||
sOldUrl = "http://localhost/nominatim_old/search.php?format=json&city=%s&street=%s&addressdetails=1"
|
||||
sLineUrl = "http://localhost/nominatim/search.php?format=json&city=%s&street=%s&addressdetails=1"
|
||||
start_old = time.time()
|
||||
for address in aAddresses:
|
||||
if 'house_number' in address and 'road' in address:
|
||||
responseOld = url.urlopen(sOldUrl % (address['city'], address['house_number']+' '+address['road']))
|
||||
#dataOld = json.load(responseOld)
|
||||
#print dataOld[0]['display_name']
|
||||
elif 'road' in address:
|
||||
responseOld = url.urlopen(sOldUrl % (address['city'], address['road']))
|
||||
#dataOld = json.load(responseOld)
|
||||
#print dataOld[0]['display_name']
|
||||
end_old = time.time()
|
||||
for address in aAddresses:
|
||||
if 'house_number' in address and 'road' in address:
|
||||
responseLine = url.urlopen(sLineUrl % (address['city'], address['house_number']+' '+address['road']))
|
||||
elif 'road' in address:
|
||||
responseLine = url.urlopen(sLineUrl % (address['city'], address['road']))
|
||||
end_line = time.time()
|
||||
|
||||
print "Seconds old search for %d elements: %f" % (num,end_old-start_old)
|
||||
print "Seconds line search for %d elements: %f" % (num,end_line-end_old)
|
||||
|
||||
|
||||
test(100)
|
||||
# 100 points: old: 7.11 sec, new: 7.47 sec
|
||||
# 1000 points: old: 65.69 sec, new: 66.96 sec
|
@ -1,7 +0,0 @@
|
||||
import numpy as np
|
||||
|
||||
def getPoints(num, sw_lng, sw_lat, ne_lng, ne_lat):
|
||||
aResult = np.empty(shape=(num,2))
|
||||
for i in range(0,num):
|
||||
aResult[i] = [np.random.uniform(ne_lng, sw_lng), np.random.uniform(sw_lat, ne_lat)]
|
||||
return aResult
|
@ -1,49 +0,0 @@
|
||||
import numpy as np
|
||||
import urllib2 as url
|
||||
import json as json
|
||||
import random_points_bbox
|
||||
|
||||
def test_compare(strUrl1, strUrl2, iPoints):
|
||||
#define bounding box for test
|
||||
# sw: left-lower corner
|
||||
sw_lng= -100.815
|
||||
sw_lat= 46.789
|
||||
# ne right-top corner
|
||||
ne_lng= -100.717
|
||||
ne_lat= 46.84
|
||||
#first get some random points in the bbox
|
||||
aPoints = random_points_bbox.getPoints(iPoints, -100.815, 46.789, -100.717, 46.84)
|
||||
same = 0
|
||||
differ = 0
|
||||
differ_street=0
|
||||
missing_housenumber_1=0
|
||||
missing_housenumber_2=0
|
||||
for point in aPoints:
|
||||
response = url.urlopen( strUrl1 % (point[1],point[0]))
|
||||
data1 = json.load(response)
|
||||
response = url.urlopen(strUrl2 % (point[1],point[0]))
|
||||
data2 = json.load(response)
|
||||
if data1['address'] == data2['address']:
|
||||
same+=1
|
||||
elif 'road' in data1['address'] and 'road' in data2['address']:
|
||||
differ+=1
|
||||
print 'different: '+str(data1['address'])+' - ' + str(data2['address'])
|
||||
if data1['address']['road'] != data2['address']['road']:
|
||||
differ_street +=1
|
||||
if 'house_number' not in data1['address']:
|
||||
missing_housenumber_1 +=1
|
||||
print 'missing housenumber in Line: '+str(data1['address'])
|
||||
if 'house_number' not in data2['address']:
|
||||
missing_housenumber_2 +=1
|
||||
print 'missing housenumber in Old: '+str(data2['address'])
|
||||
|
||||
|
||||
print 'Number of same values: '+str(same)
|
||||
print 'Number of different values: '+str(differ)
|
||||
print 'Number of different streets: '+str(differ_street)
|
||||
print 'Points without housenumber in Line: '+str(missing_housenumber_1)
|
||||
print 'Points without housenumber in Old: '+str(missing_housenumber_2)
|
||||
strUrlLine = "http://localhost/nominatim/reverse.php?format=json&lat=%f&lon=%f"
|
||||
strUrlOld = "http://localhost/nominatim_old/reverse.php?format=json&lat=%f&lon=%f"
|
||||
|
||||
test_compare(strUrlLine,strUrlOld, 100)
|
@ -1,31 +0,0 @@
|
||||
import numpy as np
|
||||
import urllib2 as url
|
||||
import time
|
||||
|
||||
def test(strUrl, iPoints):
|
||||
#define bounding box for test
|
||||
# sw: left-lower corner
|
||||
sw_lng= -100.815
|
||||
sw_lat= 46.789
|
||||
# ne right-top corner
|
||||
ne_lng= -100.717
|
||||
ne_lat= 46.84
|
||||
aXvalues = np.linspace(ne_lng, sw_lng, num=iPoints)
|
||||
aYvalues = np.linspace(sw_lat, ne_lat, num=iPoints)
|
||||
for x in aXvalues:
|
||||
for y in aYvalues:
|
||||
url.urlopen( strUrl % (y,x))
|
||||
|
||||
strUrlLine = "http://localhost/nominatim/reverse.php?format=json&lat=%f&lon=%f"
|
||||
start_time_line=time.time()
|
||||
test(strUrlLine, 10)
|
||||
end_time_line=time.time()
|
||||
strUrlOld = "http://localhost/nominatim_old/reverse.php?format=json&lat=%f&lon=%f"
|
||||
start_time_old=time.time()
|
||||
test(strUrlOld, 10)
|
||||
end_time_old=time.time()
|
||||
print("Line: --- %s seconds ---" % (end_time_line-start_time_line))
|
||||
print("Old: --- %s seconds ---" % (end_time_old-start_time_old))
|
||||
|
||||
#tested on 9th March 2016: Line: 354 seconds, Old: 363 seconds (with iPoints=100 => 10.000 single points)
|
||||
# Line: 3.586 sec, Old: 3.643 sec (witch iPoints=10 => 100 single points)
|
@ -4,7 +4,7 @@
|
||||
|
||||
// General settings
|
||||
@define('CONST_Debug', false);
|
||||
@define('CONST_Database_DSN', 'pgsql://@/nominatim_lines'); // <driver>://<username>:<password>@<host>:<port>/<database>
|
||||
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
|
||||
@define('CONST_Database_Web_User', 'www-data');
|
||||
@define('CONST_Max_Word_Frequency', '50000');
|
||||
@define('CONST_Limit_Reindexing', true);
|
||||
@ -84,7 +84,7 @@
|
||||
@define('CONST_BulkUserIPs', '');
|
||||
@define('CONST_BlockMessage', ''); // additional info to show for blocked IPs
|
||||
|
||||
@define('CONST_Website_BaseURL', 'http://localhost/nominatim/');
|
||||
@define('CONST_Website_BaseURL', 'http://'.php_uname('n').'/');
|
||||
@define('CONST_Tile_Default', 'Mapnik');
|
||||
|
||||
@define('CONST_Default_Language', false);
|
||||
|
Loading…
Reference in New Issue
Block a user