nextcloud / weather

⛅️ Weather app for Nextcloud
GNU Affero General Public License v3.0
47 stars 27 forks source link

Cities with the same names #67

Closed team-epk closed 5 years ago

team-epk commented 5 years ago

Steps to reproduce

  1. Open Weather
  2. Try to add a city that shares a name with a larger city somewhere else
  3. Get weather report for the wrong city

Expected behaviour

I should get the weather for my city, in my state (which I specify when I add the city).

Actual behaviour

I get the weather for the larger city in a different state when I enter either my city's name. I've tried it with neighboring towns, but they also share names with other cities/towns in the world, most of which are larger. (I checked a Nextcloud install I have on a Raspberry Pi that I use for testing, which was installed manually, and it exhibits the same behavior, fwiw.) I can get my weather at openweathermap.com, which gives me the option of picking my town from a list of towns with this name. I know my longitude/latitude coordinates, but there's not an option to add the weather that way.

Server configuration detail

Operating system: Ubuntu server 18.04.1 LTS

Webserver: Apache/2.4.34 (Unix) (fpm-fcgi)

Database: mysql 5.7.22

PHP version:

7.1.22 Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, bz2, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, mcrypt, pcntl, PDO, session, pdo_sqlite, posix, Reflection, standard, SimpleXML, mysqlnd, exif, tokenizer, xml, xmlreader, xmlwriter, zip, pdo_mysql, cgi-fcgi, redis, Zend OPcache

Nextcloud version: 13.0.6 - 13.0.6.1

Updated from an older Nextcloud/ownCloud or fresh install: fresh

Where did you install Nextcloud from: installed the snap version during server install

Signing status Array ( )
List of activated apps ``` Enabled: - activity: 2.6.1 - apporder: 0.5.0 - bookmarks: 0.12.2 - calendar: 1.6.1 - comments: 1.3.0 - contacts: 2.1.5 - dav: 1.4.7 - deck: 0.4.1 - federatedfilesharing: 1.3.1 - federation: 1.3.0 - files: 1.8.0 - files_sharing: 1.5.0 - files_texteditor: 2.5.1 - files_trashbin: 1.3.0 - files_versions: 1.6.0 - files_videoplayer: 1.2.0 - firstrunwizard: 2.2.1 - gallery: 18.0.0 - issuetemplate: 0.4.0 - logreader: 2.0.0 - lookup_server_connector: 1.1.0 - mail: 0.8.3 - nextcloud_announcements: 1.2.0 - notes: 2.4.2 - notifications: 2.1.2 - oauth2: 1.1.1 - password_policy: 1.3.0 - polls: 0.8.3 - provisioning_api: 1.3.0 - serverinfo: 1.3.0 - sharebymail: 1.3.0 - survey_client: 1.1.0 - systemtags: 1.3.0 - tasks: 0.9.7 - theming: 1.4.5 - twofactor_backupcodes: 1.2.3 - weather: 1.5.4 - workflowengine: 1.3.0 Disabled: - admin_audit - encryption - files_external - files_pdfviewer - user_external - user_ldap ```
Configuration (config/config.php) ``` { "apps_paths": [ { "path": "\/snap\/nextcloud\/current\/htdocs\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/snap\/nextcloud\/current\/nextcloud\/extra-apps", "url": "\/extra-apps", "writable": true } ], "supportedDatabases": [ "mysql" ], "memcache.locking": "\\OC\\Memcache\\Redis", "memcache.local": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0 }, "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "local IP:82" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "local IP:82", "dbtype": "mysql", "version": "13.0.6.1", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true } ```

Are you using external storage, if yes which one: no

Are you using encryption:

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:62.0) Gecko/20100101 Firefox/62.0

Operating system: Mac OS X Sierra

nerzhul commented 5 years ago

Hello this is not a bug, you can type Paris,FR instead of Paris to fix the state problem, all cities are cities in OpenWeatherMap database, not us :)

team-epk commented 5 years ago

If I type Chelmsford, Massachusetts, shows me Chelmsford, GB. If I type Ayer, Massachusetts, it gives me Ayer, UG. It's not a matter of whether they're considered cities or not, it's not giving me the option to choose which city I want, it just gives me whatever the top one with that name is in their database.

On the Openweathermap website, even if I type Chelmsford, Massachusetts, it puts Chelmsford, GB at the top of the list. The one I want is second on the list. I don't get a list when I type the cities in the weather app, it just gives me that top city, even when I specify the state, which I have been doing. I know my latitude and longitude, so I could use that, but it's not an option. screen shot 2018-11-05 at 5 36 48 am screen shot 2018-11-05 at 5 37 29 am

nerzhul commented 5 years ago

Type ChelmsFord, US That should do the trick, unfortunately we are limited by the OWM API

team-epk commented 5 years ago

My actual town shares a name with a larger one across the country in Colorado, so typing US doesn't fix it, since they're both in the US. Typing Massachusetts, for whatever reason, still brings up the Colorado town. I only figured this out because they have been having much warmer and drier weather than Massachusetts recently, so I knew the temperature I was getting was off. (And it was raining, and Weather said it was sunny.)

I figured the issue was probably something to do with the API, which is a bummer. Without being able to choose from the list, or lat/long, I think I'm out of luck. I'm not sure why Openweathermap ignores the state like this, but maybe I'll send a message to their support center and see what they say. Thanks for your help!

nerzhul commented 5 years ago

thanks, if they have a code implementation solution tell us :)

welchomatic commented 1 year ago

I'm having this issue. In my case, when I want to use Duluth, US I have two choices. Duluth, Minnesota, US and Duluth, Georgia, US. Both cities have the same string - Duluth, US. Is there a way to have the API choose the second Duluth, given that the string for both cities is the exact same?

DopeJackalope commented 1 year ago

According to open weather map API's documentation, you should be able to search by ZIP code. When searching by zip code, if a country is not specified, it defaults to the US. All you need to do is type "zip=" rather than "q=". I just tested it because I was wondering the exact same thing about city names when I discovered that "Richmond Texas" often comes up before "Richmond VA" in a lot of web searches. I hope someone finds this helpful.

Best