{"id":21277948,"url":"https://github.com/b13/geocoding","last_synced_at":"2025-07-11T08:32:12.462Z","repository":{"id":5822322,"uuid":"7037672","full_name":"b13/geocoding","owner":"b13","description":"TYPO3 Extension: Geocoding: Provides services for google maps GeoCoding API","archived":false,"fork":false,"pushed_at":"2024-05-16T10:38:52.000Z","size":90,"stargazers_count":15,"open_issues_count":3,"forks_count":9,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-01T08:48:07.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-12-06T15:13:28.000Z","updated_at":"2024-05-16T10:38:18.000Z","dependencies_parsed_at":"2024-05-16T11:31:58.922Z","dependency_job_id":"35f031c9-4d47-4651-bd49-8dba22e01c56","html_url":"https://github.com/b13/geocoding","commit_stats":{"total_commits":45,"total_committers":6,"mean_commits":7.5,"dds":0.1777777777777778,"last_synced_commit":"050898b45b2521314b418076f7256bd71421cc98"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b13%2Fgeocoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b13%2Fgeocoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b13%2Fgeocoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b13%2Fgeocoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b13","download_url":"https://codeload.github.com/b13/geocoding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225708281,"owners_count":17511635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T10:08:23.259Z","updated_at":"2024-11-21T10:08:23.910Z","avatar_url":"https://github.com/b13.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TYPO3 Extension: Geocoding\n\nProvides services for querying Google Maps GeoCoding API v3 in your own extensions.\n\n* Extension Key: geocoding\n* Author: Benjamin Mack, b13 GmbH, 2012-2024\n* Licensed under: GPLv2+\n* Requires TYPO3 11+ and PHP 8.1 (see older versions of EXT:geocoding for support for previous TYPO3 versions)\n* All code can be found and developed on github: https://github.com/b13/geocoding/\n\n## Introduction\nThis extension provides an abstract way to get geo coordinates of addresses around the world. \"Geocoding\" let you fetch information about an address and stores it in the DB, by using the TYPO3 Caching Framework.\n\n## Installation\nUse `composer req b13/geocoding` or install it via TYPO3's Extension Manager from the TYPO3 Extension Repository using the extension key `geocoding`.\n\n## Configuration\nFetch a Google API key (https://code.google.com/apis/console) and add it to the extension configuration info in the Extension Manager. For more information see here: https://developers.google.com/maps/documentation/geocoding/?hl=en\n\n## How to use\nInject the class in your TYPO3 extension. In the rare case, that you cannot use dependency injection, `GeneralUtility::makeInstance()` works as well.\n\n## GeoService\nThe extension provides the `GeoService`, a PHP service class to fetch latitude and longitude for a specific address string.\n\n### GeoService-\u003ecalculateCoordinatesForAllRecordsInTable\n\nIf you need to query user input, a JavaScript API is probably the best way to do so. However, it can be done via PHP as well, by calling `GeoService-\u003egetCoordinatesForAddress($street, $zip, $city, $country)`\n\n\t$coordinates = $this-\u003egeoServiceObject-\u003egetCoordinatesForAddress('Breitscheidstr. 65', 70176, 'Stuttgart', 'Germany');\n\nThe method also caches the result of the query.\n\n### GeoService-\u003ecalculateCoordinatesForAllRecordsInTable\n\nThe method `GeoService-\u003ecalculateCoordinatesForAllRecordsInTable($tableName, $latitudeField, $longitudeField, $streetField, $zipField, $cityField, $countryField, $addWhereClause)` allows you to bulk-encode latitude and longitude fields for existing addresses. The call can easily be built inside a Scheduler Task (see example below).\n\nThis way you can fetch the information about an address of a DB record (e.g. tt_address) and store the data in the database table, given that you add two new fields latitude and longitude to that target table in your extension (no TCA information required for that).\n\n### Example: Using GeoService as a Scheduler Task for tt_address\n\nPut this into `EXT:my_extension/Classes/Task/GeocodingTask.php`:\n\n```php\n\u003c?php\nnamespace MyVendor\\MyExtension\\Task;\n\n/**\n * Class to be called by the scheduler to\n * find geocoding coordinates for all tt_address records\n */\nclass GeocodingTask extends \\TYPO3\\CMS\\Scheduler\\Task\\AbstractTask\n{\n    /**\n     * Function executed from the Scheduler.\n     */\n    public function execute()\n    {\n        /** @var \\B13\\Geocoding\\Service\\GeoService $geocodingService */\n        $geocodingService = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance(\\B13\\Geocoding\\Service\\GeoService::class);\n        $geocodingService-\u003ecalculateCoordinatesForAllRecordsInTable(\n            'tt_address',\n            'latitude',\n            'longitude',\n            'address',\n            'zip',\n            'city',\n            'country'\n        );\n        return true;\n    }\n}\n```\n\nAnd also register this class within `ext_localconf.php` of your extension:\n\n```php\n$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\\MyVendor\\MyExtension\\Task\\GeocodingTask::class] = [\n    'extension'        =\u003e 'myextension',\n    'title'            =\u003e 'Geocoding of address records',\n    'description'      =\u003e 'Check all tt_address records for geocoding information and write them into the fields'\n];\n```\n\n### RadiusService\nThe other main service class is used for the calculating distances between two coordinates (`RadiusService-\u003egetDistance()`, and querying records from a DB table with latitude and longitude (works perfectly in conjunction with `calculateCoordinatesForAllRecordsInTable()`) given a certain radius and base coordinates.\n\n\n## Thanks / Contributions\n\nThanks go to\n\n* The crew at b13, making use of these features\n* Jesus Christ, who saved my life.\n\n2013-07-05, Benni.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb13%2Fgeocoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb13%2Fgeocoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb13%2Fgeocoding/lists"}