fourello-devs/openstreetmap

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel-flavored OpenStreetMap SDK

dev-master 2021-05-08 22:33 UTC

This package is auto-updated.

Last update: 2023-03-27 19:15:59 UTC


README

Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require fourello-devs/openstreetmap

Usage

This package offers two convenient way to directly use OpenStreetMap.

  • OpenStreetMap facade
  • osm() helper function

There are three (3) methods available for you to use:

  • getSearch()
  • getReverse()
  • getStatus()

This package is some form of Laravel-flavored SDK for OpenStreetMap. To learn more about OpenStreetMap, please refer to this documentation.

Note: There should be five (5) methods supposedly but due to time constraint and project requirements, the remaining two which are Address Lookup and Details are not included. You can fork this project for free. If given a chance, I will include the remaining two in the future.

Setup Environment Variables

# (optional) Comma-separated Country Codes
OSM_COUNTRY_CODES=PH,JP
# (optional) Number of places to display (min: 10, max: 50)
OSM_SEARCH_LIMIT=5
# (optional) 
OSM_EMAIL_ADDRESS=carlo.luchavez@fourello.com

For complete list of country codes, visit Wikipedia.

If you are making large numbers of request please include an appropriate email address to identify your requests. See Nominatim's Usage Policy for more details.

Demonstration

use FourelloDevs\OpenStreetMap\Models\Request\Reverse;
use FourelloDevs\OpenStreetMap\Models\Request\Search;

Route::get('status', function () {

    return osm()->getStatus();
    
});

Route::get('search', function () {

    $search = new Search();
    $search->q = 'Manila';
    $search->includeAddressDetails();
    $search->includeExtraTags();

    return osm()->getSearch($search);
    
});

Route::get('reverse', function () {

    $reverse = new Reverse();
    $reverse->lat = -34.4391708;
    $reverse->lon = -58.7064573;
    $reverse->includeAddressDetails();
    $reverse->includeExtraTags();

    return osm()->getReverse($reverse);
    
});

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email carlo.luchavez@fourello.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.