Giter Site home page Giter Site logo

geographer's People

Contributors

big-shark avatar dusterio avatar enniel avatar ginopane avatar jamosaur avatar maicol07 avatar michaelantipenko avatar slaubi avatar timacdonald avatar vsychov avatar willishq avatar xmk avatar xoref avatar zquintana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geographer's Issues

Arabic Translation Support

Our team would like to contribute to the translation into Arabic. If you are interested, can you create a "geographer-ar" repository using English translation, so that we can create a PR with Arabic translations?

File not found

File not found: /var/www/sites/site.loc/vendor/menarasolutions/geographer-ru/resources/city/TT.json

France regions (getState()) returns deprecated ISO 3166-2 codes

The data for france regions was valid until 2015 and looked like this:
Elsass (Alsace) | (FR-A)

with a total of 22 regions.

2016 there was a change to three letter codes and only 13 regions like this:
Auvergne-Rhône-Alpes | FR-ARA

[see https://de.wikipedia.org/wiki/ISO_3166-2:FR]

[RFC] Re-use of doctrine collections

Your collection implementation looks similar to Doctrines ArrayCollectionwithObjectRepository` ontop of it. What do you think about re-using some code from there?

https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/ArrayCollection.php

https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Persistence/ObjectRepository.php

https://github.com/doctrine/collections/blob/master/lib/Doctrine/Common/Collections/Selectable.php

This could lead to some interoperability with other libraries.

Static build method acts wrong in Divisible

Another mismatch i've found is that Divisible::build static method doing something wrong:

$state = State::build($id); // Instantiate a state directly, based on $id provided (Geonames) 

Instead of searching for state with $id, Repositories\File::getCodeFromIndex will search provided $id in indexCountry.json because Divisible::build calls Repository::indexSearch method with static::$parentClass as second argument, which will be equal to Geographer/Country in this case:

    public static function build($id, $config = null)
    {
        $config = $config ?: new DefaultManager();
        $meta = $config->getRepository()
            ->indexSearch($id, static::$parentClass);
        $parent = isset($meta['parent']) ? $meta['parent'] : null;

        return new static($meta, $parent, $config);
    }

I guess static::class should be used there ?

Why method Country->getCapital does not work with v0.3.10 ?

Hello,
About a month ago I wrote that method Country->getCapital does not work.

At branch #40 I got feedback :

I took a look and it turns out this part was never finished properly :) I fixed the method in the code and added a test, but somebody has to make a pull request on geographer-data repo - edit resources/cities/*.json files adding "capital" property to the corresponding entries, eg:
"long": { "default": "Moscow" }, "capital": true,

Now I have the same problem .
I page : https://github.com/MenaraSolutions/geographer/releases/tag/v0.3.10

Fix get capital method
@dusterio dusterio released this 22 days ago

v0.3.10

In composer.json I modified version of the package and now it has content :

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "cviebrock/eloquent-sluggable": "^8.0",
        "drewm/mailchimp-api": "^2.5",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "jenssegers/agent": "^2.6",
        "laravel/fortify": "^1.7",
        "laravel/framework": "^8.12",
        "laravel/sanctum": "^2.8",
        "laravel/socialite": "^5.2",
        "laravel/tinker": "^2.5",
        "laravelcollective/html": "^6.2",
        "maatwebsite/excel": "^3.1",
        "mailchimp/mailchimp": "^2.0",
        "menarasolutions/geographer": "^0.3.10",
        "mews/purifier": "^3.3",
        "mobiledetect/mobiledetectlib": "^2.8",
        "monarobase/country-list": "^3.2",
        "spatie/browsershot": "^3.40",
        "spatie/emoji": "^2.2",
        "spatie/geocoder": "^3.10",
        "spatie/laravel-image-optimizer": "^1.6",
        "spatie/laravel-permission": "^4.0",
        "stidges/laravel-country-flags": "^2.0",
        "stripe/stripe-php": "^7.75",
        "toin0u/geocoder-laravel": "^4.4",
        "wboyz/laravel-enum": "^0.2.1",
        "webpatser/laravel-uuid": "^3.0"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel-frontend-presets/tailwindcss": "^4.3",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "files": [
            "app/library/helper.php"
        ],
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

I run commands :


php artisan config:cache
php artisan route:cache
php artisan cache:clear
php artisan view:clear
php artisan  clear-compiled

composer dump-autoload


and removed “/vendor” and “/composer.lock” and run
composer install and after that example from docs:

        $thailand = $earth->getCountries()->findOne(['code' => 'TH']);
        $capital = $thailand->getCapital(); // return NULL

I do not if pull request on geographer-data repo was done, but with
"menarasolutions/geographer": "^0.3.10"
I expected this method woul work properly.

How can I make it working?

Thanks!

GeoBase update

Hello, is it planned to update the geo database? The current database is very outdated

Contribution guide

Did not see any contribution guidelines in the Readme file but would be very glad to contribute with translations in German and Bulgarian.

My question is if there is something particular, which I and other potential contributors have to be aware of. (would be a good idea to add basic information about the contribution guidelines in the Readme imho)

Undefined index: long

Good afternoon, when I try to get all the cities on request

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
use MenaraSolutions\Geographer\Earth;
use MenaraSolutions\Geographer\City;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        $city = new City();
        $city = $city->toArray();
        View::share('city', $city);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

and

    <pre>
    <?php var_dump($city); ?>
    </pre>

Have some error: Undefined index: long
what am I doing wrong?

[BUG]: State::build() with states/divisions with a single character

Describe the bug
Currently if you try to use State::Build() this will fail when the state/division has a single character. e.g. Bangladesh - Dhaka

To Reproduce
Steps to reproduce the behavior:

$country = 'BD';
$state = 'C';

$meta = State::build("{$country}-{$state}")->getMeta();

This will throw:
MenaraSolutions\Geographer\Exceptions\ObjectNotFoundException
Cannot find object with id BD-C

Is README obsolete ?

Is documentation obsolete or i am missing something ?

$countries = $earth->getCountries();
$thailand = $countries->findOne(['code' => 'TH']);

Will not work because $earth->getCountries() returns MemberCollection instance, which has no findOne method, only inherited from Divisible has it ( Country, City, State ).

Not ISO 3166 compliant for African countries

Country list does not exactly match ISO 3166 for at least the African country list. It seems like it's out-of-date:

Missing:

  • British Indian Ocean Territory
  • French Southern Territories

Changed:
Current => ISO 3166

  • Swaziland => Eswatini

Mismatch
Current => ISO 3166

  • Reunion => Réunion
  • United Republic of Tanzania => Tanzania, United Republic of

Provide an geographer-nl

Hello,

We'd like to integrate Geographer in our solution, is there any way you could provide a package for dutch ?
Or describing how we could gather and package data on our own ?

Thank you.

PHP 8.1 Errors

Output:

PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of MenaraSolutions\Geographer\Divisible::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

feature: danish translation

our team would like to contribute the danish translations. If you are interested, can you create the geographer-da repository with the english text and we create a PR with the translations?

or are there other ways on how to provide you with the needed information?

Cannot find object with id at ../vendor/menarasolutions/geographer/src/Repositories/File.php:190)

I don't see any problems in work. But I have an error in the logs:

Cannot find object with id {"userId":109,"exception":"[object] (MenaraSolutions\Geographer\Exceptions\ObjectNotFoundException(code: 0): Cannot find object with id at /var/www/site.com/main/vendor/menarasolutions/geographer/src/Repositories/File.php:190)
[stacktrace]
#0 /var/www/site.com/main/vendor/menarasolutions/geographer/src/Repositories/File.php(203): MenaraSolutions\Geographer\Repositories\File->getCodeFromIndex()
#1 /var/www/site.com/main/vendor/menarasolutions/geographer/src/Divisible.php(203): MenaraSolutions\Geographer\Repositories\File->indexSearch()
#2 /var/www/site.com/main/app/Models/Geography.php(119): MenaraSolutions\Geographer\Divisible::build()
#3 /var/www/site.com/main/app/Http/Controllers/GeographyController.php(116): App\Models\Geography::cities()
#4 [internal function]: App\Http\Controllers\GeographyController->reqCities()
....

Why in MenaraSolutions/geographer plugin I can not get info on USA capital?

In Laravel 8 I with https://github.com/MenaraSolutions/geographer I need to get capital and its lat/lng
of any country, but I failed to get it with code:

$selectedCountry = $earth->getCountries()->setLocale('en')->findOne(['code' => strtoupper($next_country_key)]);
\Log::info(  varDump($selectedCountry, ' -1 $selectedCountry::') );
$capital = $selectedCountry->getCapital();
\Log::info(  varDump($capital, ' -1 $capital::') );
$countriesArray[] = [
    'label' => $next_country_label,
    'value' => $next_country_key,
    'geonames_code' => $capital->getGeonamesCode(),
    'lat' => $capital->getLatitude(),
    'lng' => $capital->getLongitude(),
];

I got error :

Call to a member function getGeonamesCode() on bool 

as

$selectedCountry->getCapital() 

returned false.

Checking in log content of $selectedCountry var I see:

[2021-04-09 07:26:49] local.INFO:  (Object of MenaraSolutions\Geographer\Country) : -1 $selectedCountry:: : Array
(
    [ * memberClass] => MenaraSolutions\Geographer\State
    [ * exposed] => Array
        (
            [code] => ids.iso_3166_1.0
            [code3] => ids.iso_3166_1.1
            [isoCode] => ids.iso_3166_1.0
            [numericCode] => ids.iso_3166_1.2
            [geonamesCode] => ids.geonames
            [fipsCode] => ids.fips
            [0] => area
            [1] => currency
            [phonePrefix] => phone
            [2] => mobileFormat
            [3] => landlineFormat
            [4] => trunkPrefix
            [5] => population
            [6] => continent
            [language] => languages.0
            [7] => name
        )

    [ * meta] => Array
        (
            [languages] => Array
                (
                    [0] => en
                )

            [ids] => Array
                (
                    [iso_3166_1] => Array
                        (
                            [0] => US
                            [1] => USA
                            [2] => 840
                        )

                    [fips] => US
                    [geonames] => 6252001
                )

            [long] => Array
                (
                    [default] => United States of America
                )

            [short] => Array
                (
                    [default] => United States
                )

            [area] => 9629091
            [currency] => USD
            [phone] => 1
            [trunkPrefix] => 1
            [landLineFormat] => [2-9]\d{9}
            [mobileFormat] => [2-9]\d{9}
            [continent] => NA
            [population] => 310232863
        )

    [ * members] => 
    [ * manager] => MenaraSolutions\Geographer\Services\DefaultManager Object
        (
            [translator:protected] => MenaraSolutions\Geographer\Services\TranslationAgency Object
                (
                    [basePath:protected] => /mnt/_work_sdb8/wwwroot/lar/tAdsBack/vendor/menarasolutions/geographer/resources/
                    [repository:protected] => MenaraSolutions\Geographer\Repositories\File Object
                        (
                            [prefix:protected] => /mnt/_work_sdb8/wwwroot/lar/tAdsBack/vendor/menarasolutions/geographer-data/resources
                            [translationsPrefix:protected] => /mnt/_work_sdb8/wwwroot/lar/tAdsBack/vendor/menarasolutions
                            [cache:protected] => Array
                                (
                                )

                        )

                    [form:protected] => default
                    [inflictsTo:protected] => Array
                        (
                        )

                    [prepositions:protected] => 1
                    [languages:protected] => Array
                        (
                            [ru] => MenaraSolutions\Geographer\Services\Poliglottas\Russian
                            [en] => MenaraSolutions\Geographer\Services\Poliglottas\English
                            [es] => MenaraSolutions\Geographer\Services\Poliglottas\Spanish
                            [it] => MenaraSolutions\Geographer\Services\Poliglottas\Italian
                            [fr] => MenaraSolutions\Geographer\Services\Poliglottas\French
                            [zh] => MenaraSolutions\Geographer\Services\Poliglottas\Mandarin
                            [uk] => MenaraSolutions\Geographer\Services\Poliglottas\Ukrainian
                            [de] => MenaraSolutions\Geographer\Services\Poliglottas\German
                            [nl] => MenaraSolutions\Geographer\Services\Poliglottas\Dutch
                        )

                    [translators:protected] => Array
                        (
                        )

                )

            [repository:protected] => MenaraSolutions\Geographer\Repositories\File Object
                (
                    [prefix:protected] => /mnt/_work_sdb8/wwwroot/lar/tAdsBack/vendor/menarasolutions/geographer-data/resources
                    [translationsPrefix:protected] => /mnt/_work_sdb8/wwwroot/lar/tAdsBack/vendor/menarasolutions
                    [cache:protected] => Array
                        (
                        )

                )

            [language:protected] => en
            [form:protected] => 
            [standard:protected] => iso
            [brief:protected] => 1
            [prepositions:protected] => 1
            [path:protected] => /mnt/_work_sdb8/wwwroot/lar/tAdsBack/vendor/menarasolutions/geographer/resources/
        )

    [ MenaraSolutions\Geographer\Divisible parent] => 
    [ * parentCode] => SOL-III
    [ * standard] => 
)

Does this package have no info on USA capital or something wrong in my code?
I followed docs on github page...

"menarasolutions/geographer": "^0.3.9",
"menarasolutions/geographer-laravel": "^0.2.1",
"laravel/framework": "^8.12",

Thanks!

ALL cities

Hello!

I read issue #18 about all cities. So could you please make additional db with all-all cities? It is VERY need.

Warnings PHP>=8.0

Return type of MenaraSolutions\Geographer\Divisible::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in .../vendor/menarasolutions/geographer/src/Traits/ExposesFields.php on line 46

Return type of MenaraSolutions\Geographer\Collections\Traits\ImplementsArray::unserialize($serialized) should either be compatible with ArrayObject::unserialize(string $data): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in .../vendor/menarasolutions/geographer/src/Collections/Traits/ImplementsArray.php on line 74

Lumen Service Provide issue

HI I am trying to add the package in lumen but when i try to register the package it give me error that class Integrations is not available can you please check that

Ability to get all cities from country

Hi, maybe I didn't investigated, but is there an ability to directly get cities within a country?
The problem is that some small countries doesn't have states, so I couldn't get cities for this country.

Thanks!

Кастомные коллекции

Здравствуйте.
Подскажите пожалуйста, есть ли возможность использовать кастомную memberCollection?
Или может вы можете интегрировать функцию slice в дефолт?

    public function slice($offset, $length = null)
    {
        return new static($this->manager, array_slice($this->_divisions, $offset, $length, true));
    }

очень полезна для постраничного вывода

No cities in Gabon

Hi,
It seems you lost most of the Gabon cities: Akieni, Bakoumba, Bitam, Bongoville, Booue, Cocobeach, Fougamou, Franceville, Gamba, Kango, Koula-Moutou, Lambarene, Lembamba, Leconi, Makokou, Mandji, Mayumba, Mbigou, Medouneu, Mekambo, Mimongo, Minvoul, Mitzic, Moabj, Moanda, Mouila, Ndende, N'Djole, N'Toum, Okondja, Omboue, Ovan, Oyem, Pana, Tchibanga.
There are only two cities in the geographer-data pkg for Gabon.

All cities The Netherlands

Hi, I have a problem that not all cities from The Netherlands are included in the NL.json file (geographer-data/resources/NL.json). I have a dating site and i want that users from all cities to be able to register on my site, because now people from certain cities cannot register and this is a big problem for me. Can you generate a NL.json file with all cities from The Netherlands and mail it to me? or find another solution?

Best Regards,

Media4now

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.