Plotting different area objects in OSMnx










0














I am wondering if it is possible to plot area objects from OSM through OSMnx.



It seems to me, that there is an easy way only to plot buildings. But I would like to be able to plot e.g. rivers, but can't find a place to specify this.



I was hoping for a similar mechanism to plotting different way objects (e.g. power lines) through infrastructure parameter in graph_from_bbox function.
Is there something like that but for areas?



What I did already is to try a minimal example:



import osmnx as ox
ox.config(use_cache=True, log_console=True)
point = (50.045199, 19.939229)
dist = 300
north, south, east, west = ox.bbox_from_point(point, distance=dist)

# power lines around southern california
G = ox.graph_from_bbox(north=north, south=south, east=east, west=west,
retain_all=True, truncate_by_edge=True, simplify=False,
network_type='none', infrastructure='way["power"~"line"]')
fig, ax = ox.plot_graph(ox.project_graph(G))


Next I tried to alter the way["power"~"line"] for other types of things, including areas, but it returned an error. But I did not find any other obvious way to request area objects than this parameter.










share|improve this question























  • Is this question only about plotting? That is, have you successfully used OSMnx to download the data of interest and now just want to plot it? If so, please post your code so far.
    – gboeing
    Nov 13 '18 at 21:19










  • Yes, the only thing I want to do is to get some elements from the OSM (e.g. roads and rivers) into a plot and then save it to work with it in a graphics editor. I haven't tried downloading the data itself. I have never used OSM API or any geo-data software, so I only modified the expamples you kindly provided with osmnx (which are awesome, just as the package, thanks for that!). So if there is a way around it (getting the data alone and then plotting it separately), it would be great if you could point me to some examples of how to do it.
    – marcin
    Nov 15 '18 at 21:27















0














I am wondering if it is possible to plot area objects from OSM through OSMnx.



It seems to me, that there is an easy way only to plot buildings. But I would like to be able to plot e.g. rivers, but can't find a place to specify this.



I was hoping for a similar mechanism to plotting different way objects (e.g. power lines) through infrastructure parameter in graph_from_bbox function.
Is there something like that but for areas?



What I did already is to try a minimal example:



import osmnx as ox
ox.config(use_cache=True, log_console=True)
point = (50.045199, 19.939229)
dist = 300
north, south, east, west = ox.bbox_from_point(point, distance=dist)

# power lines around southern california
G = ox.graph_from_bbox(north=north, south=south, east=east, west=west,
retain_all=True, truncate_by_edge=True, simplify=False,
network_type='none', infrastructure='way["power"~"line"]')
fig, ax = ox.plot_graph(ox.project_graph(G))


Next I tried to alter the way["power"~"line"] for other types of things, including areas, but it returned an error. But I did not find any other obvious way to request area objects than this parameter.










share|improve this question























  • Is this question only about plotting? That is, have you successfully used OSMnx to download the data of interest and now just want to plot it? If so, please post your code so far.
    – gboeing
    Nov 13 '18 at 21:19










  • Yes, the only thing I want to do is to get some elements from the OSM (e.g. roads and rivers) into a plot and then save it to work with it in a graphics editor. I haven't tried downloading the data itself. I have never used OSM API or any geo-data software, so I only modified the expamples you kindly provided with osmnx (which are awesome, just as the package, thanks for that!). So if there is a way around it (getting the data alone and then plotting it separately), it would be great if you could point me to some examples of how to do it.
    – marcin
    Nov 15 '18 at 21:27













0












0








0







I am wondering if it is possible to plot area objects from OSM through OSMnx.



It seems to me, that there is an easy way only to plot buildings. But I would like to be able to plot e.g. rivers, but can't find a place to specify this.



I was hoping for a similar mechanism to plotting different way objects (e.g. power lines) through infrastructure parameter in graph_from_bbox function.
Is there something like that but for areas?



What I did already is to try a minimal example:



import osmnx as ox
ox.config(use_cache=True, log_console=True)
point = (50.045199, 19.939229)
dist = 300
north, south, east, west = ox.bbox_from_point(point, distance=dist)

# power lines around southern california
G = ox.graph_from_bbox(north=north, south=south, east=east, west=west,
retain_all=True, truncate_by_edge=True, simplify=False,
network_type='none', infrastructure='way["power"~"line"]')
fig, ax = ox.plot_graph(ox.project_graph(G))


Next I tried to alter the way["power"~"line"] for other types of things, including areas, but it returned an error. But I did not find any other obvious way to request area objects than this parameter.










share|improve this question















I am wondering if it is possible to plot area objects from OSM through OSMnx.



It seems to me, that there is an easy way only to plot buildings. But I would like to be able to plot e.g. rivers, but can't find a place to specify this.



I was hoping for a similar mechanism to plotting different way objects (e.g. power lines) through infrastructure parameter in graph_from_bbox function.
Is there something like that but for areas?



What I did already is to try a minimal example:



import osmnx as ox
ox.config(use_cache=True, log_console=True)
point = (50.045199, 19.939229)
dist = 300
north, south, east, west = ox.bbox_from_point(point, distance=dist)

# power lines around southern california
G = ox.graph_from_bbox(north=north, south=south, east=east, west=west,
retain_all=True, truncate_by_edge=True, simplify=False,
network_type='none', infrastructure='way["power"~"line"]')
fig, ax = ox.plot_graph(ox.project_graph(G))


Next I tried to alter the way["power"~"line"] for other types of things, including areas, but it returned an error. But I did not find any other obvious way to request area objects than this parameter.







python osmnx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 21:20







marcin

















asked Nov 12 '18 at 22:48









marcinmarcin

34




34











  • Is this question only about plotting? That is, have you successfully used OSMnx to download the data of interest and now just want to plot it? If so, please post your code so far.
    – gboeing
    Nov 13 '18 at 21:19










  • Yes, the only thing I want to do is to get some elements from the OSM (e.g. roads and rivers) into a plot and then save it to work with it in a graphics editor. I haven't tried downloading the data itself. I have never used OSM API or any geo-data software, so I only modified the expamples you kindly provided with osmnx (which are awesome, just as the package, thanks for that!). So if there is a way around it (getting the data alone and then plotting it separately), it would be great if you could point me to some examples of how to do it.
    – marcin
    Nov 15 '18 at 21:27
















  • Is this question only about plotting? That is, have you successfully used OSMnx to download the data of interest and now just want to plot it? If so, please post your code so far.
    – gboeing
    Nov 13 '18 at 21:19










  • Yes, the only thing I want to do is to get some elements from the OSM (e.g. roads and rivers) into a plot and then save it to work with it in a graphics editor. I haven't tried downloading the data itself. I have never used OSM API or any geo-data software, so I only modified the expamples you kindly provided with osmnx (which are awesome, just as the package, thanks for that!). So if there is a way around it (getting the data alone and then plotting it separately), it would be great if you could point me to some examples of how to do it.
    – marcin
    Nov 15 '18 at 21:27















Is this question only about plotting? That is, have you successfully used OSMnx to download the data of interest and now just want to plot it? If so, please post your code so far.
– gboeing
Nov 13 '18 at 21:19




Is this question only about plotting? That is, have you successfully used OSMnx to download the data of interest and now just want to plot it? If so, please post your code so far.
– gboeing
Nov 13 '18 at 21:19












Yes, the only thing I want to do is to get some elements from the OSM (e.g. roads and rivers) into a plot and then save it to work with it in a graphics editor. I haven't tried downloading the data itself. I have never used OSM API or any geo-data software, so I only modified the expamples you kindly provided with osmnx (which are awesome, just as the package, thanks for that!). So if there is a way around it (getting the data alone and then plotting it separately), it would be great if you could point me to some examples of how to do it.
– marcin
Nov 15 '18 at 21:27




Yes, the only thing I want to do is to get some elements from the OSM (e.g. roads and rivers) into a plot and then save it to work with it in a graphics editor. I haven't tried downloading the data itself. I have never used OSM API or any geo-data software, so I only modified the expamples you kindly provided with osmnx (which are awesome, just as the package, thanks for that!). So if there is a way around it (getting the data alone and then plotting it separately), it would be great if you could point me to some examples of how to do it.
– marcin
Nov 15 '18 at 21:27












0






active

oldest

votes











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',
autoActivateHeartbeat: false,
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%2f53271216%2fplotting-different-area-objects-in-osmnx%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271216%2fplotting-different-area-objects-in-osmnx%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto