Skip to main content
deleted 3 characters in body
Source Link
JosephG
  • 111
  • 5

I need to extract restaurants from a planet.osm.pbf file. I assume the best way to do this is with Osmosis, however I need to save this data in my own database format. (Not something standard like Postgres or something else with existing plugins). Therefore, I need to write a Java application to do this, yet the Osmosis documentation seems very confusing to me. What I need to do is this:

Pseudocode:

while(file.hasNext("amenity=restaurant"))
{
     Amenity restaurant = this.amenity;
     String street = restaurant.street;
     String city = restaurant.city;
     String region = restaurant.region;
     String name = restaurant.name;
     String cuisine = restaurant.cuisine;
     // I do my own thing with this information here...
}

I can read the file in with FileInputStream, etc... I just don't understand how to parse and extract data specifically.

I think thisThis information would be extremely valuable to people like me, allowing people to extract this type of data and use it howwith ease, so they like in their own systemsdon't have to scour the internet as I did.

I need to extract restaurants from a planet.osm.pbf file. I assume the best way to do this is with Osmosis, however I need to save this data in my own database format. (Not something standard like Postgres or something else with existing plugins). Therefore, I need to write a Java application to do this, yet the Osmosis documentation seems very confusing to me. What I need to do is this:

Pseudocode:

while(file.hasNext("amenity=restaurant"))
{
     Amenity restaurant = this.amenity;
     String street = restaurant.street;
     String city = restaurant.city;
     String region = restaurant.region;
     String name = restaurant.name;
     String cuisine = restaurant.cuisine;
     // I do my own thing with this information here...
}

I can read the file in with FileInputStream, etc... I just don't understand how to parse and extract data specifically.

I think this information would be extremely valuable to people like me, allowing people to extract this data and use it how they like in their own systems.

I need to extract restaurants from a planet.osm.pbf file. I assume the best way to do this is with Osmosis, however I need to save this data in my own database format. (Not something standard like Postgres or something else with existing plugins). Therefore, I need to write a Java application to do this, yet the Osmosis documentation seems very confusing to me. What I need to do is this:

Pseudocode:

while(file.hasNext("amenity=restaurant"))
{
     Amenity restaurant = this.amenity;
     String street = restaurant.street;
     String city = restaurant.city;
     String region = restaurant.region;
     String name = restaurant.name;
     String cuisine = restaurant.cuisine;
     // I do my own thing with this information here...
}

I can read the file in with FileInputStream, etc... I just don't understand how to parse and extract data specifically.

This information would be extremely valuable, allowing people to extract this type of data with ease, so they don't have to scour the internet as I did.

Source Link
JosephG
  • 111
  • 5

Extract specific amenity Osmosis with Java api

I need to extract restaurants from a planet.osm.pbf file. I assume the best way to do this is with Osmosis, however I need to save this data in my own database format. (Not something standard like Postgres or something else with existing plugins). Therefore, I need to write a Java application to do this, yet the Osmosis documentation seems very confusing to me. What I need to do is this:

Pseudocode:

while(file.hasNext("amenity=restaurant"))
{
     Amenity restaurant = this.amenity;
     String street = restaurant.street;
     String city = restaurant.city;
     String region = restaurant.region;
     String name = restaurant.name;
     String cuisine = restaurant.cuisine;
     // I do my own thing with this information here...
}

I can read the file in with FileInputStream, etc... I just don't understand how to parse and extract data specifically.

I think this information would be extremely valuable to people like me, allowing people to extract this data and use it how they like in their own systems.