GithubHelp home page GithubHelp logo

Comments (3)

wannesm avatar wannesm commented on May 24, 2024 1

This probably means no matching is found. If you projected to meters than the values 2 and 1 are quite small (e.g. noise of only 1m is expected). More realistic values would be around 50m.

You can increase the output by setting the logging level (using the logging module):

leuvenmapmatching.logger.setLevel(logging.INFO)  # or if you want to see all steps: logging.DEBUG
leuvenmapmatching.logger.addHandler(logging.StreamHandler(sys.stdout))  # add only if you don't see any output, otherwise it appears double

from leuvenmapmatching.

Huzaifg avatar Huzaifg commented on May 24, 2024

I am facing the same error for a similar setup

from leuvenmapmatching.

Huzaifg avatar Huzaifg commented on May 24, 2024

Yes using the logger did help. I was able to obtain the states after playing around with the parameters. However, now I am currently facing another issue with the states. I am using the following code to get the edge ids

matcher = DistanceMatcher(map_con, max_dist=1000, max_dist_init=2000, # meter min_prob_norm=0.001, non_emitting_length_factor=0.75, obs_noise=10, obs_noise_ne=75, # meter dist_noise=10, # meter non_emitting_edgeid=False) edgeid, lastidx = matcher.match(path)

Here map_con is generated with the following code

# Creation of the Leuven Map object from the OSM network
    map_con = InMemMap("myosm", use_latlon=True, use_rtree=True, index_edges=True)
    # Add the OSM network into the Leuven Map object
    nodes_id = list(graph.nodes)
    for node in nodes_id:
        lat = graph.nodes[node]['y']
        lon = graph.nodes[node]['x']
        map_con.add_node(node, (lat, lon))
    edges_id = list(graph.edges)
    for edge in edges_id:
        node_a, node_b = edge[0], edge[1]
        map_con.add_edge(node_a, node_b)
        map_con.add_edge(node_b, node_a)

    map_con.purge()

I am getting edgeids for all of my 2000 GPS points. However , some edge ids do not match to any road in the graph obtained from open street network.

For example the point 19.136265,74.008378 is snapped to road with edge id 6038805371, 6038806293.

The graph I use is generated using osmnx with -

G = ox.graph_from_bbox(20.045204,18.569678,74.3,73.637611,network_type = 'drive')

and converted into a geodataframe using -

trip_nodes, trip_streets = ox.graph_to_gdfs(G)

trip_streets then is the following geodataframe -
Screenshot 2021-06-30 at 11 37 55 AM

However, now when in try to index into trip_streets using u = 6038805371, v = 6038806293 , key = 0/1/2, I get a KeyError.

This happens in my case for 8 more roads given by edgeids
6038806293 , 6038792279 | 6038792279 6038792985 | 6038792985 6038792245 | 6038792245 6038792997 6038792997 6038792249 | 6038779847 6038779861 | 6038779861 6038779869 | 6038779869 2213151251

I wonder why this happens. My aim is to ultimately find the geometry of the edge onto which my GPS point has been projected for which I need to use the edgeids obtained from the function to index out the geometry from a OSM geodataframe.

Any help will be appreciated.
Best

Edit 1 - Formated better

from leuvenmapmatching.

Related Issues (20)

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.