How to use OpenStreetMap API in Laravel (PHP) Application?

Hi there! My name is Leandro. I’m writing from Buenos Aires, Argentina.

First of all, since I’m not a native english speaker, please tell me if I’m making some grammar errors, or if there’s something I’m writing in the post which is not properly understood.

My issue is this one: I’m making my final degree project for a programming and development career at the National Technological University (Universidad Tecnológica Nacional - UTN).
For it, I’m developing an application for publishing and consulting real estate rentals, focused on the informal market, such as rented rooms, or buildings into informal settlements.
For it, I’m considering using the OpenStreetMap API, since I know some important sites which use it.

One of those, is the official Buenos Aires map site, maintained by the city government:

On it, has a lot of functionalities implemented, such as calculating the all the available options for being transported from one point of the city to another, both by car and by public transport, among many other things.

Another one, is a site called ArgenProp, which is also a site for consulting and publishing real estate rentals or sales, but focused on the formal market.
This site has implemented an OpenStreetMap visualizer, in which you can draw an area, and then the site returns you all buildings published for being rented or sold within that area, as you can see here:

So then, I’d like to achieve something similar in my application.

I’ve decided to build my app using the Laravel PHP Framework, since I once had a job interview at a real estate enterprise which used that tool for software development, and it’s increasingly demanded into the development market.

I’d also like to add a compatibility layer with the Google Maps/Earth API, since it’s used by almost all the smartphone users. I’m wondering also, how to use the GPS device of the phones to integrate it with the app.

I’m a pretty newbie user of OpenStreetMap API. I’ve been searching a lot on Google for the usage of it, but I couldn’t found an appropriate starting point for doing what I need to.

I’ve found this post on a site named Laracasts (which provides support for Laravel) with some tools suggested, but it’s quite old and the tools suggested in there run out of support long ago:

https://laracasts.com/discuss/channels/laravel/about-open-street-maps

Since I’m in Argentina, I’ve been searching for sites which provide support, specifically focused on this country, even the OSM Community of Argentina.

However, I’ve couldn’t found the appropriate support, since all the places I’ve consulted had very few posts, and also quite outdated (for example, the OSM Community of Argentina has no activity since 2016).

I think there must be a way to use OSM API to pass it the geographical coordinates of some building or place, and making the API to return me the correspondent data of that place, such as province (provincia), municipality (municipio), neighborhood (barrio), and all data correspondent to the jurisdictions (according to the ones existing in Argentina). Also, the correspondent street and and address number of the building.
The opposite case should be also contemplated: the API should return me the geographical coordinates of the building based on the jurisdiction and address data of some building I’m posting.
Since I’m even contemplating buildings for being rented into informal settlements, I can have a case of a building without any street and address number at all.

I think there’s must be a way of using the OSM API, regardless of the language or technology used for the development of the application, by handling URL petitions and JSON and/or XML documents.

Does anyone have an idea of where I can find a starting point for the kind of things I want to, or if there’s a better place to consult for it? Even for making a pretty basic “Hello World!” usage of the API.

Thanks a lot!
Greetings.

Leandro

Hi.

THE OSM API is used mainly for editing the common database, it can be used to fetch data, but it’s not easy nor that efficient.

Other API provide structured queries, such as overpass, or routing (graphhopper, OSRM, etc.), geocoding (nominatim, sophox…) and so on.

I seems you’ll need a lot of reading, the OSM wiki is the best place in this case.

facilmap is a nice project, which uses a lot of (mapbox) APIs, it might serve as inspiration.

Best regards.

2 Likes

Downloading data - OpenStreetMap Wiki page may help

1 Like

Hi! There’s a OSM AR community in Telegram Telegram: Contact @osm_ar Fell free to join!

Hola! Hay una comunidad OSM AR en Telegram Telegram: Contact @osm_ar Veni, hacete Amici!

1 Like

Thank you to everyone!
I’ll take your answers into account!