Giter Club home page Giter Club logo

openrouteservice-examples's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openrouteservice-examples's Issues

https://openrouteservice.org/dieselgate-avoid-berlin-banned-diesel-streets/ has dead elements - maps.heigit.org/openmapsurfer/tiles/roads/webmercator for start

Here's what I did

Signed up for an account and opened https://openrouteservice.org/dieselgate-avoid-berlin-banned-diesel-streets/

Here's what I got

map in an example is gray, console shows that https://maps.heigit.org/openmapsurfer/tiles/roads/webmercator/14/8800/5372.png and similar fail with 410 Gone error


Here's what I was expecting

A working example


Here's what I think could be improved

Fix link rot

General storyline

Hi @isikl,
I'd suggest to drop the part about hgv vs. car. Maybe more like:

  • route Munich-Budapest with hgv
  • I like your extra_info idea: request them with a normal hgv route and display the results similar to what you already did (don't forget some legend, hard to read)
  • then request a route with avoid_features=tollways in an options dict and compare the route to the original request
  • finally (if a lot of tolls in Austria), avoid Austria and compare as well with the 2 previous requests

Can you calculate the distance driven on tollway roads? Not sure what's in the extra_info response. Otherwise you could estimate toll costs maybe?! Also not sure how the toll system in Austria works..

Can't create isochrone in apartment_Search

When running the /openrouteservice.org/example-apartment-search-with-ors-example, the creation of isochrone fails here

for name, apt in apt_dict.items():
    params_iso['locations'] = apt['location'] # Add apartment coords to request parameters
    apt['iso'] = clnt.isochrones(**params_iso) # Perform isochrone request
    folium.features.GeoJson(apt['iso']).add_to(map1) # Add GeoJson to map

With this error

ApiError                                  Traceback (most recent call last)
<ipython-input-2-6fc3e64952b4> in <module>()
     19 for name, apt in apt_dict.items():
     20     params_iso['locations'] = apt['location'] # Add apartment coords to request parameters
---> 21     apt['iso'] = clnt.isochrones(**params_iso) # Perform isochrone request
     22     folium.features.GeoJson(apt['iso']).add_to(map1) # Add GeoJson to map
     23 

~/.local/lib/python3.6/site-packages/openrouteservice/client.py in wrapper(*args, **kwargs)
    290     def wrapper(*args, **kwargs):
    291         args[0]._extra_params = kwargs.pop("extra_params", None)
--> 292         result = func(*args, **kwargs)
    293         try:
    294             del args[0]._extra_params

~/.local/lib/python3.6/site-packages/openrouteservice/isochrones.py in isochrones(client, locations, profile, range_type, intervals, segments, units, location_type, attributes, intersections, dry_run)
    123         params["attributes"] = convert._pipe_list(attributes)
    124 
--> 125     return client.request("/isochrones", params, dry_run=dry_run)

~/.local/lib/python3.6/site-packages/openrouteservice/client.py in request(self, url, params, first_request_time, retry_counter, requests_kwargs, post_json, dry_run)
    206 
    207         try:
--> 208             result = self._get_body(response)
    209             self.sent_times.append(time.time())
    210             return result

~/.local/lib/python3.6/site-packages/openrouteservice/client.py in _get_body(self, response)
    232         if status_code != 200:
    233             raise openrouteservice.exceptions.ApiError(status_code,
--> 234                                                        body)
    235 
    236         return body

ApiError: 500 ({'error': {'code': 3099, 'message': 'Unable to build an isochrone map.'}, 'info': {'engine': {'version': '4.5.0', 'build_date': '2018-03-26T14:41:01Z'}, 'timestamp': 1525696593278}})

Is this working for you as it is?

Apartment _ Search

I am unable to get the code in the second cell (POIs around apartments) to run (Apartment_Search.ipynb).!

Screen Shot 2021-06-14 at 3 13 15 PM

This is the error "list indices must be integers or slices, not str”

It should work as written. The first cell runs perfectly. I tried in Jupyter notebook and Colab in case it was a folium issue.

Thanks for any help. I want to adapt the code for another project in a different city...

Bonny

TypeError in In[8] and ValueError in In[12]

Hi, I am a newbie here, especially in the GIS related areas. While learning by practicing and digesting your provided Jupyter Examples (which were very helpful) – starting with example “apartment search with openrouteservice” (https://openrouteservice.org/example-apartment-search-with-ors/), I ran into 2 errors and thought you might be interested in knowing (I’m not sure if it was because of my new environment (openrouteservice 2.3.3, python 3.8.8)):

Error #1: TypeError in In[8]**

 17         params_poi['filter_category_ids'] = category
 18         apt['categories'][typ] = dict()

---> 19 apt['categories'][typ]['geojson']= clnt.places(**params_poi)['features'] # Actual POI request
20 print("\t{}: {}".format(typ, # Print amount POIs
21 len(apt['categories'][typ]['geojson'])))

TypeError: list indices must be integers or slices, not str

Solution:
The error was fixed after I changed line #19 to "clnt.places(**params_poi)[0]['features'] # Actual POI" (by adding a [0] before [features]. This was due to the fact that "clnt.places(**params_poi)" is a list, not a dict.


Error #2: ValueError in In[12]

  1 # Sum up the closest POIs to each apartment
  2 for name, apt in apt_dict.items():

----> 3 apt['shortest_sum'] = sum([min(cat['durations']) for cat in apt['categories'].values()])
4 print("{} apartments: {} mins".format(name,
5 apt['shortest_sum']/60

in (.0)
1 # Sum up the closest POIs to each apartment
2 for name, apt in apt_dict.items():
----> 3 apt['shortest_sum'] = sum([min(cat['durations']) for cat in apt['categories'].values()])
4 print("{} apartments: {} mins".format(name,
5 apt['shortest_sum']/60

ValueError: min() arg is an empty sequence

Solution:
The error was fixed after I changed line #3 to "sum([min(cat['durations'], default=0) for cat in apt['categories'].values()]) " (by adding default=0 in the min() method to avoid the error when there was an empty cat[‘durations’].

Spiegel comic linked in Dieselgate example has linkrotted

Here's what I did

Signed up for an account and opened https://openrouteservice.org/dieselgate-avoid-berlin-banned-diesel-streets/


Here's what I got

https://www.spiegel.de/images/image-1349732-galleryV9-ikww-1349732.jpg is a dead link

Here's what I was expecting

no dead links


Here's what I think could be improved

remove or replace by an archive version

http://web.archive.org/web/20210602120517/https://www.spiegel.de/images/image-1349732-galleryV9-ikww-1349732.jpg sole capture is also dead

Make notebook more accessible

Generally:

  • too scientific. Reads more like a thesis. Purpose: legibility and reproducibility.
  • try to avoid methods. If much conciser, go ahead and define methods.
  • I like the way you're printing dataframes. Consider printing df.head() though. Good to have reminders what the data looks like, but the whole table is not necessary.
  • text blocks should be much shorter. Noone will read this if it's too long.

Twwet Data for 'tweets/tweets_magdeburg.shp'

Hello I'm looking to create a Proof of concept of this. we need to see how this data is being utilized therefore we need the data set where you've obtained it from etc. or if you can share that file in the resource/data as a part of this repo

Thanking in anticipation.

Add examples with R

Would be nice to see some R examples on the website, too.
(cc @aoles main developer of the R package)

Would be happy to help or make a student project (maybe bachelor thesis?) out of this. Let me know if this is interesting for you.

This is related to #1

external dependency zonal_stats

The zonal_stats function is needed for the Healthcare Access Madagascar notebook but is located in an external file which has additional dependencies.

Examples should work as they are without having to copy external files that introduce additional dependencies.

Either include the dependencies in environment, and copy over the file or find another solution

Few improvements to Logistics example

  1. No need for HD polygon here actually. You're not using it except for plotting. Think you can leave it out.
  2. The first locations list:
  • Only give the addresses and demands as assumption and use geocoding (the Pelias endpoint pls) to get the coordinates
  • change the order to address, demand, long, lat
  1. I generally like the approach with numpy and pandas, but try to keep your variables named, i.e. try to avoid to do e.g. route[:, ::-1].T. It's best done in dictionaries, I find, where you can put named keys. It makes it a lot nicer and easier to read.
  2. reversed for an iterator is preferrable over [::-1]. Both for performance and readability.

Apart from that, very well done. I know, it can be hard, but try to think most practical with these examples, a fluid storytelling with just enough info to solve a certain problem in the most elegant and readable way.

matrix API does not return symmetrical matrix

Using the matrix API (metric=['distance']) does not yield a symmetrical matrix. However, the distance from node i to node j should be the same as from node j to node i (with i unequal j).

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.