DJ. Aduvanchik
DJ. Aduvanchik

Reputation: 342

How to access the OSM API

I am making an app where I need access to the maxspeed in the OSM database. I found the api http://overpass-api.de/api/ in the OSM wiki http://wiki.openstreetmap.org/wiki/Overpass_API but I can't find a way to access it and when I search the api online it reaturns the Forbidden error.

How can I program my app to access the api so I can query the database json to find the maxspeed for my android app.

Upvotes: 1

Views: 1244

Answers (1)

MKer
MKer

Reputation: 3450

OSMBonusPack (an addon lib to osmdroid) has an OverpassAPIProvider, ready to use, without your "Forbidden" issue.

If it doesn't exactly fit your need, looking at the source code should help you to implement what you want.

EDIT

Using OverpassAPI may not be straightforward to get the "current" maxspeed ...

Following mmd suggestion, here is the piece of code from velociraptor to build their OverpassAPI request string:

private String getOsmQuery(Location location) {
    return "[out:json];" +
            "way(around:15,"
            + location.getLatitude() + ","
            + location.getLongitude() +
            ")" +
            "[\"highway\"];out body geom;";
}

This may help...

Upvotes: 2

Related Questions