def test_encode_coordinates_json():
    expected = {
        'coordinates': [
            [-87.33787536621092, 36.539156961321574],
            [-88.2476806640625, 36.92217534275667]]}

    assert expected == json.loads(encode_coordinates_json(gj_point_features))
    assert expected == json.loads(encode_coordinates_json(gj_multipoint_features))
    assert expected == json.loads(encode_coordinates_json(gj_line_features))
Exemple #2
0
def test_encode_coordinates_json():
    expected = {
        'coordinates': [
            [-87.33787536621092, 36.539156961321574],
            [-88.2476806640625, 36.92217534275667]]}

    assert expected == json.loads(encode_coordinates_json(gj_point_features))
    assert expected == json.loads(encode_coordinates_json(gj_multipoint_features))
    assert expected == json.loads(encode_coordinates_json(gj_line_features))
Exemple #3
0
 def distances(self, features, profile='driving'):
     profile = self._validate_profile(profile)
     coords = encode_coordinates_json(features)
     uri = URITemplate(self.baseuri + '/{profile}').expand(profile=profile)
     res = self.session.post(uri, data=coords,
                             headers={'Content-Type': 'application/json'})
     self.handle_http_error(res)
     return res
Exemple #4
0
 def distances(self, features, profile='driving'):
     profile = self._validate_profile(profile)
     coords = encode_coordinates_json(features)
     uri = URITemplate(self.baseuri + '/{profile}').expand(profile=profile)
     res = self.session.post(uri,
                             data=coords,
                             headers={'Content-Type': 'application/json'})
     self.handle_http_error(res)
     return res
Exemple #5
0
    def distances(self, features, profile="driving"):
        profile = self._validate_profile(profile)
        coords = encode_coordinates_json(features)

        uri = URITemplate("%s/{profile}" % self.baseuri).expand(profile=profile)

        res = self.session.post(uri, data=coords, headers={"Content-Type": "application/json"})
        self.handle_http_error(res)
        return res