Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenPlaceGuide integration #215

Merged
merged 1 commit into from
Jul 1, 2024
Merged

Conversation

amenk
Copy link
Contributor

@amenk amenk commented Dec 10, 2023

OpenPlaceGuide is meant to be a federated network of pages that provide more details for OpenStreetMap places.

There is the https://discover.openplaceguide.org/ service which provides links to those "instances"

Currently there is only AddisMap.com registered. Everyone could run a similar service for their area using https://github.com/OpenPlaceGuide/opg-pages

(Actually AddisMap.com currently runs on older proprietary code, but the idea is to port it's main features to opg-pages)

An OPG instance uses URLs of the format $domain/$osmType/$osmId which lead to a micropage of the place.

Place place information can be enriched via different sources (currently the OPG database - a Git Repository) with all kind of information which does not directly belong to the OSM database.

This pull request implements the following:

  • Fetch federation instance(s) for the current feature from OpenPlaceGuide discover
  • Add links to the specific detail pages, if available

You can test it by clicking on some features in Ethiopia

Example: /way/50833484

Known issues: When using the back button, an undefined variable error is thrown

Copy link

vercel bot commented Dec 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
osmapp ✅ Ready (Inspect) Visit Preview Jun 23, 2024 5:30pm

@zbycz
Copy link
Owner

zbycz commented Dec 10, 2023

Few questions 🙂

  1. so discover.openplaceguide.org is kind of a router which stores data/links for any osm id? Why is there the coordinates as well? Can you please share some link to the database? I wasn't able to find it in repo (the closest was link to some https://github.com/addismap/addismap-data - which is probably private).

  2. how do you cope with OSM having unstable IDs? eg. a restaurant being a node, can easily become a way with another id, unfortunately without any link to the former.

  3. why isnt the data/link stored as tag in OSM? This way it couldn't get destroyed. I would expect something like url:opg=https://openplaceguide.org/uuid which is imho valid and proper way to do it.

regarding PR:

  1. i would like to keep the number of API requests to the bare minimum. I am ok if requests is launched on some condition (like fhrs field). It seems that this would fire for every feature clicked, and seldom deliver any data. Wouldn't it be better to hide it under some flag, and show it only at your osmapp instance?

I am ok with merging this under a flag. To allow it without, i would need to see some value for world wide users. Maybe i just dont understand the concept well. 🙂

@amenk
Copy link
Contributor Author

amenk commented Dec 10, 2023

Few questions 🙂

Thank you for asking :-)

  1. so discover.openplaceguide.org is kind of a router which stores data/links for any osm id? Why is there the coordinates as well? Can you please share some link to the database? I wasn't able to find it in repo (the closest was link to some https://github.com/addismap/addismap-data - which is probably private).

Yes, discover is a router which currently works only by bounding polygons, and currently only Ethiopia is in there - if somebody spins up a new instance, they would need make a pull request to https://github.com/OpenPlaceGuide/discover-cf-worker/blob/e5f6f7cb0de271e1bc459dbdb265652d700b5547/index.js#L45

The data for addismap.com is currently not shared, but we will port this over to the public data repository. You can have a look at https://github.com/OpenPlaceGuide/data/tree/main/places/bandira for an example of the format.

  1. how do you cope with OSM having unstable IDs? eg. a restaurant being a node, can easily become a way with another id, unfortunately without any link to the former.

Very good question - in this case, the data repository needs to be updated. We plan to have some monitoring on this which alerts the maintainer, that an OSM object went missing.

  1. why isnt the data/link stored as tag in OSM? This way it couldn't get destroyed. I would expect something like url:opg=https://openplaceguide.org/uuid which is imho valid and proper way to do it.

I believe that is not desirable to have in the OpenStreetMap database.
Also (currently) addismap provides a micropage for each POI, even there is no additional data for it - so essentially adding a UUID to each object in OSM would be very likely considered SPAM.
Some places / businesses might use the addismap.com micropage as their official page, then simply the website tag could be set.

regarding PR:

  1. i would like to keep the number of API requests to the bare minimum. I am ok if requests is launched on some condition (like fhrs field). It seems that this would fire for every feature clicked, and seldom deliver any data. Wouldn't it be better to hide it under some flag, and show it only at your osmapp instance?

I am ok with merging this under a flag. To allow it without, i would need to see some value for world wide users. Maybe i just dont understand the concept well. 🙂

You are right, currently there is only value for users browsing Ethiopia :-)
I am fine with a flag or URL parameter for now or we can leave the merge request open until we have > 1 adopters and the project is more mature.

Another approach would be to be able to download the bounding polygons so less requests are needed. But actually I wanted to keep the API and the integration to 3rd party apps as simple as possible. Also it would not scale well.

The API is hosted on Cloudflare workers and very slim. It does not query the OSM database and only evaluates the bounding polygons.

@zbycz
Copy link
Owner

zbycz commented Dec 10, 2023

Thanks, I understand everything well enough now :)

ad merging) both flag or URL parameter seems fine. Feel free to edit the PR.
As a matter of fact, I plan to add country shapefiles for whole world probably soon (for photo upload feature). If that happens, i would notify you here. It would be very easy to condition only Ethiopia then.

@amenk
Copy link
Contributor Author

amenk commented Dec 11, 2023

I will wait for the shape file inclusion then :-)

@zbycz
Copy link
Owner

zbycz commented May 15, 2024

Hi, i included the countryCode resolution #327. You can query ethiopia by feature.countryCode === 'et'

see in footer eg here: https://osmapp.org/node/237498687

@amenk
Copy link
Contributor Author

amenk commented May 15, 2024

Thanks, cool

What exactly should I see in the footer?

So shall I update the MR and query OPG for Ethiopia?

@zbycz
Copy link
Owner

zbycz commented May 15, 2024

In the footer of each FeaturePanel there is a country code in brackets near the coordinates.

Yes, you may update this PR and query OPG for countryCode === 'et'. I suggest checking for country code first thing in the <FeatureOpenPlaceGuideLink/> component. Also please use useFeatureContext instead of passing props to your component :)

@amenk
Copy link
Contributor Author

amenk commented May 25, 2024

Thanks @zbycz for the hints.
I updated this pull request, but it depends on
#327 (comment)

@amenk amenk marked this pull request as ready for review May 25, 2024 14:25
@amenk amenk force-pushed the opg-discover branch 2 times, most recently from 08a9069 to 9f7a30b Compare June 23, 2024 14:53
@amenk
Copy link
Contributor Author

amenk commented Jun 23, 2024

rebased & @zbycz ready for review

* Fetch federation instance(s) for the current feature from OpenPlaceGuide discover
* But only, if the country is list of supported countries
* Add links to the specific detail pages, if available
@zbycz zbycz merged commit 8fffdbe into zbycz:master Jul 1, 2024
2 checks passed
@amenk
Copy link
Contributor Author

amenk commented Jul 1, 2024

@zbycz thank you :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants