Skip to main content

Route4Me Python SDK

Project description

Route4Me Route Optimization Python SDK

Build Status Build status

PyPI GitHub stars

codebeat badge

codecov

Installing requirements

pip install -r requirements.txt

Installing SDK

pip install git+https://github.com/route4me/route4me-python-sdk.git

Creating a Simple Route

    from route4me import Route4Me
    from route4me.constants import ALGORITHM_TYPE, DISTANCE_UNIT, TRAVEL_MODE, OPTIMIZE

    API_KEY = "11111111111111111111111111111111"
    r4m = Route4Me(API_KEY)
    optimization = r4m.optimization
    address = r4m.address
    optimization.algorithm_type(ALGORITHM_TYPE.TSP)
    optimization.share_route(0)
    optimization.store_route(0)
    optimization.route_time(7 * 600)
    optimization.rt(True)
    optimization.route_max_duration(86400)
    optimization.route_name('Single Driver Round Trip')
    optimization.optimize(OPTIMIZE.TIME)
    optimization.distance_unit(DISTANCE_UNIT.MI)
    optimization.travel_mode(TRAVEL_MODE.DRIVING)
    address.add_address(
        address='754 5th Ave New York, NY 10019',
        lat=40.7636197,
        lng=-73.9744388,
        alias='Bergdorf Goodman',
        is_depot=True,
        time=0
    )
    address.add_address(
        address='717 5th Ave New York, NY 10022',
        lat=40.7669692,
        lng=-73.9693864,
        alias='Giorgio Armani',
        time=60
    )
    address.add_address(
        address='888 Madison Ave New York, NY 10014',
        lat=40.7715154,
        lng=-73.9669241,
        alias='Ralph Lauren Women\'s and Home',
        time=60
    )
    address.add_address(
        address='1011 Madison Ave New York, NY 10075',
        lat=40.7772129,
        lng=-73.9669,
        alias='Yigal Azrou\u00ebl',
        time=60
    )
    address.add_address(
        address='440 Columbus Ave New York, NY 10024',
        lat=40.7808364,
        lng=-73.9732729,
        alias='Frank Stella Clothier',
        time=60
    )
    address.add_address(
        address='324 Columbus Ave #1 New York, NY 10023',
        lat=40.7803123,
        lng=-73.9793079,
        alias='Liana',
        time=60
    )
    address.add_address(
        address='110 W End Ave New York, NY 10023',
        lat=40.7753077,
        lng=-73.9861529,
        alias='Toga Bike Shop',
        time=60
    )
    address.add_address(
        address='555 W 57th St New York, NY 10019',
        lat=40.7718005,
        lng=-73.9897716,
        alias='BMW of Manhattan',
        time=60
    )
    address.add_address(
        address='57 W 57th St New York, NY 10019',
        lat=40.7558695,
        lng=-73.9862019,
        alias='Verizon Wireless',
        time=60
    )

    response = r4m.run_optimization()
    print("Optimization Problem ID: {}".format(response.get("optimization_problem_id")))
    for a in response.get("addresses", []):
        print('{} - {} - {}'.format(a.get("sequence_no"), a.get("alias"), a.get("address")))

FAQS

What does the Route4Me SDK permit me to do?

This SDK makes it easier for you use the Route4Me API, which creates optimally sequenced driving routes for many drivers.

Who can use the Route4Me SDK (and API)?

The service is typically used by organizations who must route many drivers to many destinations. In addition to route optimization for new (future) routes, the API can also be used to analyze historical routes, and to distribute routes to field personnel.

Who is prohibited from using the Route4Me SDK (and API)?

The Route4Me SDK and API cannot be resold or used in a product or system that competes directly with Route4Me. This means that developers cannot resell route optimization services to other businesses or developers. However, developers can integrate our route optimization SDK/API into their software applications. Developers and startups are also permitted to use our software for internal purposes (i.e. a same day delivery startup).

How does the API/SDK Integration Work?

A Route4Me customer, integrator, or partner incorporates the Route4Me SDK or API into their code base. Route4Me permits any paying subscriber to interact with every part of its system using it’s API. The API is RESTful, which means that it’s web based and can be accessed by other programs and machines The API/SDK should be used to automate the route planning process, or to generate many routes with minimal manual intervention

Do optimized routes automatically appear inside my Route4Me account?

Every Route4Me SDK instance needs a unique API key. The API key can be retrieved inside your Route4Me.com account, inside the Settings tab called API. When a route is planned, it appears inside the corresponding Route4Me account. Because Route4Me web and mobile accounts are synchronized, the routes will appear in both environments at the same time.

Can I test the SDK with other addresses without a valid API Key?

No. The sample API key only permits you to optimize routes with the sample address coordinates that are part of this SDK.

Does the SDK have rate limits?

The number of requests you can make per second is limited by your current subscription plan. Typically, there are different rate limits for these core features: Address Geocoding & Address Reverse Geocoding Route Optimization & Management Viewing a Route

What is the recommended architecture for the Route4Me SDK?

There are two typical integration strategies that we recommend. Using this SDK, you can make optimization requests and then the SDK polls the Route4Me API to detect state changes as the optimization progresses. Alternatively, you can provide a webhook/callback url, and the API will notify that callback URL every time there is a state change.

I don't need route management or mobile capabilities. Is there a lower level Route4Me API just for the optimization engine?

Yes. Please contact support@route4me.com to learn about the low-level RESTful API.

How fast is the route Route4Me Optimization Web Service?

Most routes having less than 200 destinations are optimized in 1 second or less.

Can I disable optimization when planning routes?

Yes. You can send routes with optimization disabled if you want to conveniently see them on a map, or distribute them to your drivers in the order you prefer.

Can the API be used for aerial vehicles such as drones or self-driving cars?

Yes. The API can accept lat/lng and an unlimited amount of per-address metadata. The metadata will be preserved as passthrough data by our API, so that the receiving device will have access to critical data when our API invokes a webhook callback to the device.

Are all my optimized routes stored permanently stored in the Route4Me database?

Yes. All routes are permanently stored in the database and are no longer accessible to you after your subscription is terminated.

Can I incorporate your API into my mobile application?

Route4Me’s route planning and optimization technology can only be added into applications that do not directly compete with Route4Me. This means the application’s primary capabilities must be unrelated to route optimization, route planning, or navigation.

Can I pay you to develop a custom algorithm?

Yes

Can I use your API and resell it to my customers?

White-labeling and private-labeling Route4Me is possible but the deal’s licensing terms vary considerably based on customer count, route count, and the level of support that Route4Me should provide to your customers.

Does the API/SDK have TMS or EDI, or EDI translator capabilities?

Route4Me is currently working on these features but they are not currently available for sale.

Can the API/SDK send notifications back to our system using callbacks, notifications, pushes, or webhooks?

Because Route4Me processes all routes asynchronously, Route4Me will conveniently notify the endpoint you specify as the route optimization job progresses through each state of the optimization. Every stage of the route optimization process has a unique stage id.

Does the Route4Me API and SDK work in my country?

Route4Me.com, as well as all of Route4Me’s mobile applications use the Route4Me SDK’s and API. Since Route4Me works globally, this means that all of Route4Me’s capabilities are available using the SDK’s in every country

Will the Route4Me API/SDK work in my program on the Mac, PC, or Linux?

Customers are encouraged to select their preferred operating system environment. The Route4Me API/SDK will function on any operating system that supports the preferred programming language of the customer. At this point in time, almost every supported SDK can run on any operating system.

Does the Route4Me API/SDK require me to buy my own servers?

Route4Me has its own computing infrastructure that you can access using the API and SDKs. Customers typically have to run the SDK code on their own computers and/or servers to access this infrastructure.

Does Route4Me have an on-premise solution?

Route4Me does not currently lease or sell servers, and does not have on-premise appliance solution. This would only be possible in exceptionally unique scenarios.

Does the Route4Me API/SDK require me to have my own programmers?

The time required to integrate the SDK can be as little as 1 hour or may take several weeks, depending on the number of features being incorporated into the customer’s application and how much integration testing will be done by the client. A programmer’s involvement is almost always required to use Route4Me’s technology when accessing it through the API.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

route4me-0.0.7.1.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

route4me-0.0.7.1-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file route4me-0.0.7.1.tar.gz.

File metadata

  • Download URL: route4me-0.0.7.1.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for route4me-0.0.7.1.tar.gz
Algorithm Hash digest
SHA256 9252dd2ef29d333a341c74a57f4466cedf5fa7e61136591f9ecd0f11ceff378e
MD5 8dca04fe7627f1b48168ee9e3062f720
BLAKE2b-256 5fdc85d48a7c096513f060c04d7c806318cbbfa5125854c095f29309e0221bb0

See more details on using hashes here.

File details

Details for the file route4me-0.0.7.1-py3-none-any.whl.

File metadata

  • Download URL: route4me-0.0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 49.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for route4me-0.0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae7656af83cffa03bef1e30a69d805cb204d60301780e7521284782670a417d5
MD5 6ebef482df70a0660af2233aa6c521e1
BLAKE2b-256 b390a64899f3c65cb039f734d25985d8059fca2f74912005db86fcc60f4df420

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page