Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge selector to dev for comparison #120

Open
wants to merge 69 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c5c30be
first strike
Apr 4, 2018
d691991
new style
Apr 4, 2018
fcb4f88
redesign with searchform
Apr 5, 2018
aca6d59
Bugfix + Buttons + hide over pokemon info
Apr 5, 2018
a2d5894
search for name or id + notify pokemon selector
Apr 6, 2018
75dfe3f
travis Part1
Apr 6, 2018
78fee74
travis Part2
Apr 6, 2018
04e9db3
travis Part3
Apr 6, 2018
684c140
travis Part4 - .... damn
Apr 6, 2018
d9b9810
test travis
Apr 8, 2018
e155967
Travis + Search Types
Apr 8, 2018
be18686
Travis part 32432
Apr 8, 2018
376e05b
finish! thx DarkElement1987
Apr 8, 2018
778456a
Remove RocketMap support links from ISSUE_TEMPLATE.md & README.md (#118)
darkelement1987 Apr 9, 2018
8e14cf9
fix this UGLYYYY Pokemon icon
rlodev67 Apr 12, 2018
f886ae8
Fix sprites in rarity filter (#120)
rlodev67 Apr 13, 2018
049838c
better search engine + filter presets
Apr 13, 2018
9bb5f50
config.ini.example
Apr 13, 2018
657ada1
Redesign with Searchcommands, all Presets and Arraycompare function
May 6, 2018
b74e4e6
add custom.js
May 6, 2018
8248d51
custom.js.example
May 6, 2018
908307d
Merge branch 'dev' into newselector
cecpk May 6, 2018
50fcc70
travis
May 6, 2018
87bed04
Travis2
May 6, 2018
be3a3e6
travis3
May 6, 2018
cf12561
travis4
May 6, 2018
37f9ca9
travis4 - final
May 6, 2018
a5bd623
Merge pull request #5 from SenorKarlos/dev
cecpk May 19, 2018
7464b26
first strike
May 28, 2018
daf4734
remove usused
May 28, 2018
a31f4e9
exclude Travis
May 28, 2018
e3501df
exclude Travis2
May 28, 2018
4af0dcd
heattest
May 29, 2018
40491cc
heattest2
May 29, 2018
9acb687
Statistic && Search Location fix
May 30, 2018
05a9c0e
Kill Google in Python Part & Travis (a pit:))
Jun 1, 2018
bb0e126
Kill Google - Travis a bit
Jun 1, 2018
c70f37f
Travis
Jun 1, 2018
797394f
Travis
Jun 2, 2018
b5ca268
Travis
Jun 2, 2018
d897a49
Travis
Jun 2, 2018
58b02a3
Travis
Jun 2, 2018
e133c28
Travis
Jun 2, 2018
5d38fbf
Travis
Jun 2, 2018
aa6109b
Travis
Jun 2, 2018
810a8c4
Travis
Jun 2, 2018
d40561f
Travis final
Jun 2, 2018
da389f7
Add Map Styles
Jun 2, 2018
5508fb1
Add Map Styles - Travis :D
Jun 2, 2018
45990e1
Travis ..... ok
Jun 2, 2018
a11f983
Change small bits
Jun 3, 2018
5887f2c
Fix Default Marker and Travis
Jun 4, 2018
228fe52
Fix Default Marker and Travis ...
Jun 4, 2018
b881cc4
Merge pull request #7 from cecpk/osmtest
cecpk Jun 4, 2018
2924a46
Merge pull request #8 from cecpk/newselector
cecpk Jun 4, 2018
ed7e1cc
Bugfix
Jun 5, 2018
19abbbb
Merge pull request #9 from cecpk/osmErrorFix
cecpk Jun 5, 2018
cd88443
ready
Jun 5, 2018
72f433b
ready - travis
Jun 5, 2018
b41b8f7
Merge pull request #10 from cecpk/newmenu
cecpk Jun 5, 2018
1b73f81
geofix
Jun 11, 2018
dfa8da8
geofix - travis
Jun 11, 2018
c52f8aa
Merge pull request #11 from cecpk/osmgeofix
cecpk Jun 11, 2018
85c77b0
Solve Notify Bug
Jun 11, 2018
f6a50df
Add Filter Info to Notify Pkm
Jun 11, 2018
531ea52
Merge branch 'MIX_MEWTWO' into newselector
cecpk Jun 11, 2018
c9da686
Error HTML Template
Jun 11, 2018
27aea2b
fiix map.html
Jun 11, 2018
32d232b
Add Filterinfo for Notify Pokemon
Jun 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
ISSUES ARE NOT FOR SUPPORT!!!
ISSUES ARE NOT FOR SUPPORT!!!

Join discord (channel: #help) for support at this link: https://discord.gg/rocketmap

Submit feature requests @ http://vote.devkat.org

-->

<!--- Provide a general summary of the issue in the Title above -->
Expand Down
4 changes: 1 addition & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ module.exports = function (grunt) {
'static/dist/js/statistics.built.js': 'static/js/statistics.js',
'static/dist/js/status.built.js': 'static/js/status.js',
'static/dist/js/custom.built.js': 'static/js/custom.js',
'static/dist/js/vendor/markerclusterer.built.js': 'static/js/vendor/markerclusterer.js',
'static/dist/js/serviceWorker.built.js': 'static/js/serviceWorker.js',
'static/dist/js/weather.built.js': 'static/js/weather.js'
}
}
}
},
uglify: {
Expand All @@ -69,7 +68,6 @@ module.exports = function (grunt) {
'static/dist/js/statistics.min.js': 'static/dist/js/statistics.built.js',
'static/dist/js/status.min.js': 'static/dist/js/status.built.js',
'static/dist/js/custom.min.js': 'static/dist/js/custom.built.js',
'static/dist/js/vendor/markerclusterer.min.js': 'static/dist/js/vendor/markerclusterer.built.js',
'static/dist/js/serviceWorker.min.js': 'static/dist/js/serviceWorker.built.js',
'static/dist/js/weather.min.js': 'static/dist/js/weather.built.js'
}
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ Live visualization of all the Pokémon (with option to show gyms, raids and Pok
* Incredibly fast, efficient searching algorithm (compared to everything else available)

## Information
* [Discord](https://discord.gg/rocketmap) for general support
* [Documentation](https://rocketmap.readthedocs.io/) for installation and usage docs
* [vote.devkat.org](http://vote.devkat.org) to request new features
* [Github Issues](https://github.com/RocketMap/RocketMap/issues) for reporting bugs (not for support!)
* [Github Issues](https://github.com/SenorKarlos/RocketMap/issues) for reporting bugs (not for support!)

## Installation

Expand Down
17 changes: 8 additions & 9 deletions pogom/altitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
fallback_altitude = None


def get_gmaps_altitude(lat, lng, gmaps_key):
def get_gmaps_altitude(lat, lng):
try:
r_session = requests.Session()
response = r_session.get((
'https://maps.googleapis.com/maps/api/elevation/json?' +
'locations={},{}&key={}').format(lat, lng, gmaps_key),
timeout=5)
'https://api.open-elevation.com/api/v1/lookup?' +
'locations={},{}').format(lat, lng),
timeout=30)
response = response.json()
status = response['status']
status = response['results']
results = response.get('results', [])
result = results[0] if results else {}
altitude = result.get('elevation', None)
except Exception as e:
log.exception('Unable to retrieve altitude from Google APIs: %s.', e)
log.exception('Unable to retrieve altitude from OSM APIs: %s.', e)
status = 'UNKNOWN_ERROR'
altitude = None

Expand All @@ -50,8 +50,7 @@ def get_fallback_altitude(args, loc):

# Only query if it's not set, and if it didn't fail already.
if fallback_altitude is None and fallback_altitude != -1:
(fallback_altitude, status) = get_gmaps_altitude(loc[0], loc[1],
args.gmaps_key)
(fallback_altitude, status) = get_gmaps_altitude(loc[0], loc[1])

# Failed, don't try again.
if fallback_altitude is None:
Expand All @@ -66,7 +65,7 @@ def cached_get_altitude(args, loc):
altitude = LocationAltitude.get_nearby_altitude(loc)

if altitude is None:
(altitude, status) = get_gmaps_altitude(loc[0], loc[1], args.gmaps_key)
(altitude, status) = get_gmaps_altitude(loc[0], loc[1])
if altitude is not None and altitude != -1:
LocationAltitude.save_altitude(loc, altitude)

Expand Down
2 changes: 0 additions & 2 deletions pogom/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ def fullmap(self, statusname=None):
lng=map_lng,
showAllZoomLevel=args.show_all_zoom_level,
generateImages=str(args.generate_images).lower(),
gmaps_key=args.gmaps_key,
lang=args.locale,
show=visibility_flags,
rarityFileName=args.rarity_filename)
Expand Down Expand Up @@ -701,7 +700,6 @@ def get_stats(self):
lat=self.current_location[0],
lng=self.current_location[1],
generateImages=str(args.generate_images).lower(),
gmaps_key=args.gmaps_key,
show=visibility_flags)

def get_gymdata(self):
Expand Down
18 changes: 9 additions & 9 deletions pogom/dyn_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def get_gym_icon(team, level, raidlevel, pkm, is_in_battle):
if is_in_battle:
out_filename = out_filename.replace('.png', '_B.png')
im_lines.extend(draw_battle_indicator())

gym_image = os.path.join(path_gym, '{}.png'.format(team))
return run_imagemagick(gym_image, im_lines, out_filename)

Expand Down Expand Up @@ -326,9 +325,9 @@ def pokemon_asset_path(pkm, classifier=None, gender=GENDER_UNSET,
log.warning("Cannot find PogoAssets file {}".format(
assets_fullname))
# Dummy Pokemon icon
return os.path.join(
assets_basedir, 'pokemon_icon_000.png'),
os.path.join(target_path, 'pkm_000.png')
return (
os.path.join(assets_basedir, 'pokemon_icon_000.png'),
os.path.join(target_path, 'pkm_000.png'))
return pokemon_asset_path(pkm, classifier=classifier,
gender=MALE, form=form,
costume=costume, weather=weather,
Expand All @@ -338,10 +337,10 @@ def pokemon_asset_path(pkm, classifier=None, gender=GENDER_UNSET,
def draw_gym_subject(image, size, gravity='north', trim=False):
trim_cmd = ' -fuzz 0.5% -trim +repage' if trim else ''
lines = [
'-gravity {} ( "{}"{} -scale {}x{} -unsharp 0x1 ( +clone ' +
'-gravity {} ( "{}"{} -scale {}x{} -unsharp 0x1 ( +clone '.format(
gravity, image, trim_cmd, size, size),
'-background black -shadow 80x3+5+5 ) +swap -background ' +
'none -layers merge +repage ) -geometry +0+0 -composite'.format(
gravity, image, trim_cmd, size, size)
'none -layers merge +repage ) -geometry +0+0 -composite'
]
return lines

Expand All @@ -351,9 +350,10 @@ def draw_badge(pos, fill_col, text_col, text):
lines = [
'-fill {} -stroke black -draw "circle {},{} {},{}"'.format(
fill_col, x, y, x + gym_badge_radius, y),
'-gravity center -fill {} -stroke none ' +
'-gravity center -fill {} -stroke none '.format(
text_col),
'-draw "text {},{} \'{}\'"'.format(
text_col, x - 48, y - 49, text)
x - 48, y - 49, text)
]
return lines

Expand Down
5 changes: 2 additions & 3 deletions pogom/pgscout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import sys

import requests

Expand Down Expand Up @@ -34,7 +33,7 @@ def pgscout_encounter(p, forced=False):
r = requests.get(args.pgscout_url, params=params)
except Exception:
return scout_error(
"Exception on scout: {}".format(repr(sys.exc_info()[1])))
"Exception on scout")

return r.json() if r.status_code == 200 else scout_error(
"Got error {} from scout service.".format(r.status_code))
Expand All @@ -52,7 +51,7 @@ def perform_lure(p):
r = requests.get(args.lure_url, params=params)
except Exception:
return scout_error(
"Exception on request: {}".format(repr(sys.exc_info()[1])))
"Exception on request")

return r.json() if r.status_code == 200 else scout_error(
"Got error {} from service.".format(r.status_code))
29 changes: 18 additions & 11 deletions pogom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import requests

from s2sphere import CellId, LatLng
from geopy.geocoders import GoogleV3
from geopy.geocoders import Nominatim
from requests_futures.sessions import FuturesSession
from requests.packages.urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
Expand Down Expand Up @@ -288,9 +288,6 @@ def get_args():
'search bar for use in shared maps.',
action='store_false', dest='fixed_location',
default=True)
parser.add_argument('-k', '--gmaps-key',
help='Google Maps Javascript API Key.',
required=True)
parser.add_argument('--skip-empty',
help=('Enables skipping of empty cells in normal ' +
'scans - requires previously populated ' +
Expand Down Expand Up @@ -1183,10 +1180,23 @@ def calc_pokemon_level(cp_multiplier):
return pokemon_level


def get_pos_by_name(location_name):
geolocator = Nominatim()
loc = geolocator.geocode(location_name, timeout=10)
if not loc:
return None

log.info("Location for '%s' found: %s", location_name, loc.address)
log.info('Coordinates (lat/long/alt) for location: %s %s %s', loc.latitude,
loc.longitude, loc.altitude)

return (loc.latitude, loc.longitude, loc.altitude)


@memoize
def gmaps_reverse_geolocate(gmaps_key, locale, location):
def gmaps_reverse_geolocate(locale, location):
# Find the reverse geolocation
geolocator = GoogleV3(api_key=gmaps_key)
geolocator = Nominatim()

player_locale = {
'country': 'US',
Expand Down Expand Up @@ -1216,11 +1226,8 @@ def gmaps_reverse_geolocate(gmaps_key, locale, location):
'timezone': str(timezone)
})
except Exception as e:
log.exception('Exception on Google Timezone API. '
+ 'Please check that you have Google Timezone API'
+ ' enabled for your API key'
+ ' (https://developers.google.com/maps/'
+ 'documentation/timezone/intro): %s.', e)
log.exception('Exception on Timezone API. '
+ 'Please check that you have Timezone API', e)
except Exception as e:
log.exception('Exception while obtaining player locale: %s.'
+ ' Using default locale.', e)
Expand Down
19 changes: 8 additions & 11 deletions runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pogom.app import Pogom
from pogom.utils import (get_args, now, gmaps_reverse_geolocate, init_args,
log_resource_usage_loop, get_debug_dump_link,
dynamic_rarity_refresher)
dynamic_rarity_refresher, get_pos_by_name)
from pogom.altitude import get_gmaps_altitude

from pogom.models import (init_database, create_tables, drop_tables,
Expand Down Expand Up @@ -89,7 +89,7 @@ def filter(self, record):
# Assert pgoapi is installed.
try:
import pgoapi
from pgoapi import PGoApi, utilities as util
from pgoapi import PGoApi
except ImportError:
log.critical(
"It seems `pgoapi` is not installed. Try running " +
Expand Down Expand Up @@ -262,7 +262,7 @@ def extract_coordinates(location):
position = (float(res.group(1)), float(res.group(2)), 0)
else:
log.debug('Looking up coordinates in API')
position = util.get_pos_by_name(location)
position = get_pos_by_name(location)

if position is None or not any(position):
log.error("Location not found: '{}'".format(location))
Expand Down Expand Up @@ -334,20 +334,18 @@ def main():

position = extract_coordinates(args.location)
# Use the latitude and longitude to get the local altitude from Google.
(altitude, status) = get_gmaps_altitude(position[0], position[1],
args.gmaps_key)
(altitude, results) = get_gmaps_altitude(position[0], position[1])

if altitude is not None:
log.debug('Local altitude is: %sm.', altitude)
position = (position[0], position[1], altitude)
else:
if status == 'REQUEST_DENIED':
if results == 'REQUEST_DENIED':
log.error(
'Google API Elevation request was denied. You probably ' +
'forgot to enable elevation api in https://console.' +
'developers.google.com/apis/api/elevation_backend/')
'OSM API Elevation request was denied.')
sys.exit()
else:
log.error('Unable to retrieve altitude from Google APIs' +
log.error('Unable to retrieve altitude from OSM APIs' +
'setting to 0')

log.info('Parsed location is: %.4f/%.4f/%.4f (lat/lng/alt).',
Expand Down Expand Up @@ -452,7 +450,6 @@ def main():
args.player_locale = PlayerLocale.get_locale(args.location)
if not args.player_locale:
args.player_locale = gmaps_reverse_geolocate(
args.gmaps_key,
args.locale,
str(position[0]) + ', ' + str(position[1]))
db_player_locale = {
Expand Down
18 changes: 5 additions & 13 deletions static/data/mapstyle.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"roadmap": "Roadmap",
"satellite": "Satellite",
"hybrid": "Hybrid",
"nolabels_style": "No Labels",
"dark_style": "Dark",
"style_light2": "Light2",
"style_pgo": "Pokémon Go",
"dark_style_nl": "Dark (No Labels)",
"style_light2_nl": "Light2 (No Labels)",
"style_pgo_nl": "Pokémon Go (No Labels)",
"style_pgo_day": "Pokémon Go Day",
"style_pgo_night": "Pokémon Go Night",
"style_pgo_dynamic": "Pokémon Go Dynamic"
"stylemapnik": "Mapnik",
"styleblackandwhite": "Black and White",
"styletopo": "ToPo Map",
"stylesatellite": "Satellite",
"stylewikipedia": "Wikipedia"
}
4 changes: 2 additions & 2 deletions static/data/searchmarkerstyle.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"name": "Compass",
"icon": "static/images/markers/compass.png"
},
"google": {
"name": "Default Google Marker",
"osm": {
"name": "Default OSM Marker",
"icon": null
},
"female": {
Expand Down
Binary file removed static/images/cluster/m1.png
Binary file not shown.
Binary file removed static/images/cluster/m2.png
Binary file not shown.
Binary file removed static/images/cluster/m3.png
Binary file not shown.
Binary file removed static/images/cluster/m4.png
Binary file not shown.
Binary file removed static/images/cluster/m5.png
Binary file not shown.
Loading