How to download and constrtuct a graph in osmnx?











up vote
1
down vote

favorite












I try the following code:



G = ox.graph_from_place('Greater London, UK', network_type='walk')


But it keeps giving the following error:



ConnectionError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&limit=1&dedupe=0&polygon_geojson=1&q=Greater+London%2C+UK (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f50301d5470>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))


Anyone knows anything about this bug?
Also is there a way to construct a Graph in osmnx from edges & nodes?
From the Following code:



G = ox.gdfs_to_graph(london_nodes, london_edges)


I also keep getting back the following error:



~/miniconda3/lib/python3.6/site-packages/osmnx/save_load.py in gdfs_to_graph(gdf_nodes, gdf_edges)
600 G = nx.MultiDiGraph()
601 G.graph['crs'] = gdf_nodes.crs
--> 602 G.graph['name'] = gdf_nodes.gdf_name.rstrip('_nodes')
603
604 # add the nodes and their attributes to the graph

~/miniconda3/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
4374 if self._info_axis._can_hold_identifiers_and_holds_name(name):
4375 return self[name]
-> 4376 return object.__getattribute__(self, name)
4377
4378 def __setattr__(self, name, value):

AttributeError: 'GeoDataFrame' object has no attribute 'gdf_name'


nodes have been saved before as:



london_nodes = ox.save_load.graph_to_gdfs(G, nodes=True, edges=False)


and edges as:



london_edges = ox.save_load.graph_to_gdfs(G, nodes=False, edges=True)


Thanks in advance.










share|improve this question




























    up vote
    1
    down vote

    favorite












    I try the following code:



    G = ox.graph_from_place('Greater London, UK', network_type='walk')


    But it keeps giving the following error:



    ConnectionError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&limit=1&dedupe=0&polygon_geojson=1&q=Greater+London%2C+UK (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f50301d5470>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))


    Anyone knows anything about this bug?
    Also is there a way to construct a Graph in osmnx from edges & nodes?
    From the Following code:



    G = ox.gdfs_to_graph(london_nodes, london_edges)


    I also keep getting back the following error:



    ~/miniconda3/lib/python3.6/site-packages/osmnx/save_load.py in gdfs_to_graph(gdf_nodes, gdf_edges)
    600 G = nx.MultiDiGraph()
    601 G.graph['crs'] = gdf_nodes.crs
    --> 602 G.graph['name'] = gdf_nodes.gdf_name.rstrip('_nodes')
    603
    604 # add the nodes and their attributes to the graph

    ~/miniconda3/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
    4374 if self._info_axis._can_hold_identifiers_and_holds_name(name):
    4375 return self[name]
    -> 4376 return object.__getattribute__(self, name)
    4377
    4378 def __setattr__(self, name, value):

    AttributeError: 'GeoDataFrame' object has no attribute 'gdf_name'


    nodes have been saved before as:



    london_nodes = ox.save_load.graph_to_gdfs(G, nodes=True, edges=False)


    and edges as:



    london_edges = ox.save_load.graph_to_gdfs(G, nodes=False, edges=True)


    Thanks in advance.










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I try the following code:



      G = ox.graph_from_place('Greater London, UK', network_type='walk')


      But it keeps giving the following error:



      ConnectionError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&limit=1&dedupe=0&polygon_geojson=1&q=Greater+London%2C+UK (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f50301d5470>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))


      Anyone knows anything about this bug?
      Also is there a way to construct a Graph in osmnx from edges & nodes?
      From the Following code:



      G = ox.gdfs_to_graph(london_nodes, london_edges)


      I also keep getting back the following error:



      ~/miniconda3/lib/python3.6/site-packages/osmnx/save_load.py in gdfs_to_graph(gdf_nodes, gdf_edges)
      600 G = nx.MultiDiGraph()
      601 G.graph['crs'] = gdf_nodes.crs
      --> 602 G.graph['name'] = gdf_nodes.gdf_name.rstrip('_nodes')
      603
      604 # add the nodes and their attributes to the graph

      ~/miniconda3/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
      4374 if self._info_axis._can_hold_identifiers_and_holds_name(name):
      4375 return self[name]
      -> 4376 return object.__getattribute__(self, name)
      4377
      4378 def __setattr__(self, name, value):

      AttributeError: 'GeoDataFrame' object has no attribute 'gdf_name'


      nodes have been saved before as:



      london_nodes = ox.save_load.graph_to_gdfs(G, nodes=True, edges=False)


      and edges as:



      london_edges = ox.save_load.graph_to_gdfs(G, nodes=False, edges=True)


      Thanks in advance.










      share|improve this question















      I try the following code:



      G = ox.graph_from_place('Greater London, UK', network_type='walk')


      But it keeps giving the following error:



      ConnectionError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&limit=1&dedupe=0&polygon_geojson=1&q=Greater+London%2C+UK (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f50301d5470>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))


      Anyone knows anything about this bug?
      Also is there a way to construct a Graph in osmnx from edges & nodes?
      From the Following code:



      G = ox.gdfs_to_graph(london_nodes, london_edges)


      I also keep getting back the following error:



      ~/miniconda3/lib/python3.6/site-packages/osmnx/save_load.py in gdfs_to_graph(gdf_nodes, gdf_edges)
      600 G = nx.MultiDiGraph()
      601 G.graph['crs'] = gdf_nodes.crs
      --> 602 G.graph['name'] = gdf_nodes.gdf_name.rstrip('_nodes')
      603
      604 # add the nodes and their attributes to the graph

      ~/miniconda3/lib/python3.6/site-packages/pandas/core/generic.py in __getattr__(self, name)
      4374 if self._info_axis._can_hold_identifiers_and_holds_name(name):
      4375 return self[name]
      -> 4376 return object.__getattribute__(self, name)
      4377
      4378 def __setattr__(self, name, value):

      AttributeError: 'GeoDataFrame' object has no attribute 'gdf_name'


      nodes have been saved before as:



      london_nodes = ox.save_load.graph_to_gdfs(G, nodes=True, edges=False)


      and edges as:



      london_edges = ox.save_load.graph_to_gdfs(G, nodes=False, edges=True)


      Thanks in advance.







      python geospatial osmnx






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 9:55

























      asked Nov 8 at 9:35









      Spartan

      61111




      61111
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Regarding your first question about the ConnectionError, it just looks like the Overpass API was down. It should work if you try again.



          Regarding your second question, yes you can convert between MultiDiGraphs and GeoDataFrames:



          import osmnx as ox
          ox.config(log_console=True, use_cache=True)
          G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
          nodes, edges = ox.graph_to_gdfs(G)
          G2 = ox.gdfs_to_graph(nodes, edges)


          As you can see from your error message, OSMnx does however expect all of its "expected machinery" to be present for the conversion (including a gdf_name attribute on the GeoDataFrames, for example). You can't convert just any old GeoDataFrames.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204952%2fhow-to-download-and-constrtuct-a-graph-in-osmnx%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Regarding your first question about the ConnectionError, it just looks like the Overpass API was down. It should work if you try again.



            Regarding your second question, yes you can convert between MultiDiGraphs and GeoDataFrames:



            import osmnx as ox
            ox.config(log_console=True, use_cache=True)
            G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
            nodes, edges = ox.graph_to_gdfs(G)
            G2 = ox.gdfs_to_graph(nodes, edges)


            As you can see from your error message, OSMnx does however expect all of its "expected machinery" to be present for the conversion (including a gdf_name attribute on the GeoDataFrames, for example). You can't convert just any old GeoDataFrames.






            share|improve this answer

























              up vote
              0
              down vote













              Regarding your first question about the ConnectionError, it just looks like the Overpass API was down. It should work if you try again.



              Regarding your second question, yes you can convert between MultiDiGraphs and GeoDataFrames:



              import osmnx as ox
              ox.config(log_console=True, use_cache=True)
              G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
              nodes, edges = ox.graph_to_gdfs(G)
              G2 = ox.gdfs_to_graph(nodes, edges)


              As you can see from your error message, OSMnx does however expect all of its "expected machinery" to be present for the conversion (including a gdf_name attribute on the GeoDataFrames, for example). You can't convert just any old GeoDataFrames.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                Regarding your first question about the ConnectionError, it just looks like the Overpass API was down. It should work if you try again.



                Regarding your second question, yes you can convert between MultiDiGraphs and GeoDataFrames:



                import osmnx as ox
                ox.config(log_console=True, use_cache=True)
                G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
                nodes, edges = ox.graph_to_gdfs(G)
                G2 = ox.gdfs_to_graph(nodes, edges)


                As you can see from your error message, OSMnx does however expect all of its "expected machinery" to be present for the conversion (including a gdf_name attribute on the GeoDataFrames, for example). You can't convert just any old GeoDataFrames.






                share|improve this answer












                Regarding your first question about the ConnectionError, it just looks like the Overpass API was down. It should work if you try again.



                Regarding your second question, yes you can convert between MultiDiGraphs and GeoDataFrames:



                import osmnx as ox
                ox.config(log_console=True, use_cache=True)
                G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
                nodes, edges = ox.graph_to_gdfs(G)
                G2 = ox.gdfs_to_graph(nodes, edges)


                As you can see from your error message, OSMnx does however expect all of its "expected machinery" to be present for the conversion (including a gdf_name attribute on the GeoDataFrames, for example). You can't convert just any old GeoDataFrames.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                gboeing

                37616




                37616






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204952%2fhow-to-download-and-constrtuct-a-graph-in-osmnx%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    Popular posts from this blog

                    Schultheiß

                    Liste der Kulturdenkmale in Wilsdruff

                    Android Play Services Check