Giter Site home page Giter Site logo

carto-waze's Introduction

CARTO-Waze

Connect Waze data sources and CARTO

Supported backends:

Installation

$ pip install cartowaze

Usage

More formal documentation still needs to be produced. In the meantime, please take a look at the code to find out about different ways to tailor the behavior of the connector.

Waze CCP feeds

from carto_waze.backends.waze import Alert, Jam
from carto.auth import APIKeyAuthClient


auth_client = APIKeyAuthClient("https://mycartouser.carto.com/", "mycartoapikey")

waze_url = "https://mywazeccpurl"

alerts = Alert(auth_client, url=waze_url)
with open("alerts.csv", "w") as csvfile:
    alerts.get_values(csvfile)
with open("alerts.csv", "rb") as csvfile:
    alerts.create_table(table_name="myalertstable", cartodbfy=True)
    alerts.append_data(csvfile, table_name="myalertstable")

jams = Jam(auth_client, url=waze_url)
with open('jams.csv', 'w') as jams_csv:
    jams.get_values(jams_csv)
with open("jams.csv", "rb") as csvfile:
    jams.create_table(table_name="myjamstable", cartodbfy=True)
    jams.append_data(csvfile, table_name="myjamstable")

Waze CCP Processor

from datetime import datetime
from carto_waze.backends.waze_ccp_processor import AlertProcessor, JamProcessor
from carto.auth import APIKeyAuthClient


auth_client = APIKeyAuthClient("https://mycartouser.carto.com/", "mycartoapikey")

alerts = AlertProcessor(auth_client, password="mywazeccpprocessorpassword", host="myccpprocessorhost.rds.amazonaws.com")
with open('alerts.csv', 'w') as csvfile:
    alerts.get_values(csvfile, pub_utc_date__gt=datetime(2018, 9, 20), pub_utc_date__lt=datetime(2018, 9, 21))
with open("alerts.csv", "rb") as csvfile:
    alerts.create_table(table_name="myalertstable")
    alerts.append_data(csvfile, table_name="myalertstable")

jams = JamProcessor(auth_client, password="mywazeccpprocessorpassword", host="myccpprocessorhost.rds.amazonaws.com")
with open('jams.csv', 'w') as csvfile:
    jams.get_values(csvfile, level=5)
with open("jams.csv", "rb") as csvfile:
    jams.create_table(table_name="myjamstable")
    jams.append_data(csvfile, table_name="myjamstable")

carto-waze's People

Contributors

jsanz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

carto-waze's Issues

Cannot install cartowaze

pip install cartowaze

but, it return error as below

Error checking for conflicts.
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\pip_vendor\pkg_resources_init_.py", line 2584, in version
return self.version
File "C:\Anaconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 2691, in getattr
raise AttributeError(attr)
AttributeError: _version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\pip_internal\commands\install.py", line 503, in _warn_about_conflicts
package_set, dep_info = check_install_conflicts(to_install)
File "C:\Anaconda3\lib\site-packages\pip_internal\operations\check.py", line 108, in check_install_conflicts
package_set, _ = create_package_set_from_installed()
File "C:\Anaconda3\lib\site-packages\pip_internal\operations\check.py", line 47, in create_package_set_from_installed
package_set[name] = PackageDetails(dist.version, dist.requires())
File "C:\Anaconda3\lib\site-packages\pip_vendor\pkg_resources_init
.py", line 2589, in version
raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (c:\anaconda3\lib\site-packages))

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.