pgRouting / osm2pgrouting

Import tool for OpenStreetMap data to pgRouting database
https://pgrouting.org
GNU General Public License v2.0
291 stars 111 forks source link

std::bad_alloc #255

Closed TheD3us closed 5 years ago

TheD3us commented 5 years ago

Hello,

Me too, i have the issue of std::bad_alloc : bad

I have tried the osmconvert to clear Metadata and i've tried to enlarge memory (i have 8Go)

Anyone to help me fix it ?

cayetanobv commented 5 years ago

Hi @TheD3us ,

This is a memory problem. As alsace.osm is not a large file I think you can have problems with your system configuration. Are you using a Virtual machine?

Thanks,

TheD3us commented 5 years ago

Yes i am because i need to do some tests before deploy my application. Do i need to use a real computer ?

TheD3us commented 5 years ago

I've tried with several system. I've tried on Windows, Ubuntu , OSgeolive, I know that osm2pgsql works but i need tu use osm2pgrouting. In the end I want to try pgr_NodeNetwork() because it don't work when i use osm2pgsql. I learned GIS and all pgrouting, postgis and other technologies since 5 month and i'm alone on it. I begin to became crazy, i'm tired of all this utilities who don't work.

TheD3us commented 5 years ago

All i wanted was to take a map and make some route. But with all tutorial who exist there is nothing who working correctly

TheD3us commented 5 years ago

I know that with osm2pgsql we have the --slim option, why don't we have it with osm2pgrouting ?

cayetanobv commented 5 years ago

It doesn't matter if you use a virtual or a physical machine but you need to have enought memory to process the dataset. Could you see how much memory has assigned your virtual machine? There isn't "slim" option in osm2pgrouting.

TheD3us commented 5 years ago

It's too bad for the slim option. Yes i can see, i have assigned 8GB i can up to 10 but it's all.

cayetanobv commented 5 years ago

Uhmmm I'm reviewing alsace.osm file (2.1 GB) and I think you can not enought memory with 8 GB. If you are using Linux you can add swap memory in your system; it's not as fast as RAM memory but you will haven't problems to process your file (See this issue: https://github.com/pgRouting/osm2pgrouting/issues/222). Another option is split your osm file and build topology incrementally.

TheD3us commented 5 years ago

How can i split the osm and bild topology incrementally ? there is a software who do this ?

cayetanobv commented 5 years ago

First, you need to get osm files from Overpass API using your own BBOX. From command line:

$ BBOX="1.97180,41.26684,2.26478,41.55818"

$ wget --progress=dot:mega -O "yourexampledata.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]"

Second, you can use osm2pgrouting doing incremental adition of data without using --clean. See here: https://github.com/pgRouting/osm2pgrouting#how-to-use

TheD3us commented 5 years ago

Do you know what is the difference between osm2pgsql and osm2pgrouting ?

cayetanobv commented 5 years ago

osm2pgsql: imports osm data to PostGIS. osm2pgrouting: imports osm data to PostGIS building pgRouting topology.

TheD3us commented 5 years ago

But if i do a osm2pgsql import + pgr_createTopology() , this is the same than osm2pgrouting ?

cayetanobv commented 5 years ago

The final result could be the same. The advantages for osm2pgrouting is processing speed but with a very high memory cost.

TheD3us commented 5 years ago

Ok thank you very much for all .