puzzle / decidim-zuerich

Mitwirkungsportal für die Stadt Zürich, basierend auf Decidim
https://mitwirken.stadt-zuerich.ch
GNU Affero General Public License v3.0
8 stars 2 forks source link

Decidim GEO installieren #410

Closed larsUE closed 5 months ago

larsUE commented 11 months ago

Nach Absprache mit Octree (Termin folgt), Code hier: https://github.com/octree-gva/decidim-module-geo

nicolefreypuzzle commented 9 months ago

Go von Lars von seiner Seite > sobald Puzzle bereit, loslegen

Kagemaru commented 9 months ago

Seit gestern Abend bin ich dran, Postgis für Openshift zu evaluieren. Momentan gibt es noch Probleme mit den root Permissions der offiziellen images. Ich probiere fixes dafür zu finden.

Falls dies nicht funktioniert, würden wir auf ein bestehendes non-root Image wechseln oder im schlimmsten Fall ein eigenes Image bauen.

nicolefreypuzzle commented 8 months ago

Akt. Stand:

larsUE commented 8 months ago

Aktueller Stand: https://gist.github.com/Kagemaru/ce87e421694f93947ee68362305af86a

larsUE commented 8 months ago

@Kagemaru Handliche Test-SHP-Files hier drin: KreiseStadtZuerich.zip

Kagemaru commented 7 months ago

Deployed auf INT, Lars ist informiert.

Neue Testfiles von Hadiren (unsere funktionierten nicht): quartier_wgs84.zip

larsUE commented 7 months ago

So far Decidim GEO is working fine! The only thing I'm struggling with is adding the Zürich basemap.

The maps catalogue can be located here: https://www.ogc.stadt-zuerich.ch/mapproxy/demo/# We would require the base map ("Basiskarte").

So far, I have done the following:

  1. Got WMTS link for the WGS84 version of the base map: https://www.ogc.stadt-zuerich.ch/mapproxy/demo/?wmts_layer=basiskarte_zuerich_wgs84&format=png&srs=EPSG%3A3857
  2. Adjusted the properties according to these instructions: https://opendatazurich.github.io/geoportal/
  3. Which left me with the following link: https://www.ogc.stadt-zuerich.ch/mapproxy/demo/?wmts_layer=basiskarte_zuerich_wgs84/default/ktzh/{z}/{y}/{x}.png

When I paste this into the decidim Geo config, I get the following errror.

Bildschirmfoto 2024-03-28 um 09 08 32

I tried various different combinations of coordinates or links, they all led to no map be shown or decidim Geo not appearing at all.

As I'm no web map expert, I suppose I'm overlooking something obvious here :)

@froger or @Kagemaru : Do you have an idea?

larsUE commented 7 months ago

Edit I just found the issue, this is the proper link: https://www.ogc.stadt-zuerich.ch/mapproxy/wmts/1.0.0/basiskarte_zuerich_wgs84/default/webmercator/{z}/{y}/{x}.png

larsUE commented 7 months ago

I currently can't get the positioning of a process/an assembly to work:

https://github.com/puzzle/decidim-zuerich/assets/60926257/dee9201b-3b1a-4102-a267-7217cde2abe2

@Kagemaru Could you take a look at this? I expect this is an issue with our configuration

larsUE commented 7 months ago

Testing Checklist Lars

Prod-Release

Vor Deployment

Nach Deployment

nicolefreypuzzle commented 7 months ago

@Kagemaru Analyse Problem "Prozess lokalisieren" & Info an Lars

larsUE commented 7 months ago

Rückmeldung von Octree:

When we are trying to reproduce the issue on our side everything works, so we suspect it might be related to a specific configuration on your side. Here's a hypothesis: In the decidim configuration we are using the following code in dev mode. This code needs to be changed when you move to production or it won't work:

# Map and Geocoder configuration
# == OpenStreetMap (OSM) services ==
Decidim.configure do |config|
  config.maps = {
    provider: :osm,
    api_key: Rails.application.secrets.maps[:api_key],
    dynamic: {
      tile_layer: {
        url: "[https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png](https://{s}.basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D%7Br%7D.png)",
        api_key: false,
        attribution: %(
          <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a> contributors
        ).strip
        # Translatable attribution:
        # attribution: -> { I18n.t("tile_layer_attribution") }
      }
    },
    # static: { url: "https://staticmap.example.org/" }, # optional
    geocoding: { host: "[nominatim.openstreetmap.org](http://nominatim.openstreetmap.org/)", use_https: true },
    autocomplete: { url: "https://photon.komoot.io/api/" }
  }

There are indeed limits to using servers like nominatim. More infos here: https://operations.osmfoundation.org/policies/nominatim/

Ich habe versucht, die Adresse genau so wi im Mail einzugeben, hat auch nicht geklappt.

froger commented 7 months ago

Hello! I see in your config, that the autocomplete field is with some parameters ?lat=47.378&lon=8.540, and never saw such configurations in Decidim installation.

Could you check autocomplete generally works, creating a new meeting with the adresses you tried?

Kagemaru commented 7 months ago

I've tried it without, and it doesn't accept any address as valid, either.

This was the way we used to limit the autocomplete results.

In comparison, here is the full query with priority & bounding box:

Query https://photon.komoot.io/api?lat=47.378&lon=8.540&bbox=8.43,47.312,8.64,47.442&q=bern:
Zürich, CH, Bezirk Zürich, Wiedikon, Alt-Wiedikon, Berneggweg, residential, 8045, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Berninaplatz, locality, Zürich, locality
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninastrasse, residential, 8057, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninastrasse, residential, 8050, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninaplatz, tertiary, 8057, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninaplatz, primary, 8057, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 9, Altstetten, Bernstrasse, primary, 8102, Zürich, street
Schlieren, CH, Bezirk Dietikon, Bernstrasse, primary, 8952, Zürich, street

As you can see, the results are limited to Zürich thanks to the bounding box.

If we remove the bbox parameter, we get the following results:

Query https://photon.komoot.io/api?lat=47.378&lon=8.540&q=bern:
Zürich, CH, Bezirk Zürich, Wiedikon, Alt-Wiedikon, Berneggweg, residential, 8045, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Berninaplatz, locality, Zürich, locality
Bergdietikon, CH, Bezirk Baden, Bernold, hamlet, 8962, Aargau, district
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninastrasse, residential, 8057, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninastrasse, residential, 8050, Zürich, street
CH, Verwaltungskreis Bern-Mittelland, Bern, city, Bern/Berne, city
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninaplatz, tertiary, 8057, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 11, Oerlikon, Berninaplatz, primary, 8057, Zürich, street
Zürich, CH, Bezirk Zürich, Kreis 9, Altstetten, Bernstrasse, primary, 8102, Zürich, street
Schlieren, CH, Bezirk Dietikon, Bernstrasse, primary, 8952, Zürich, street

Here some results from the canton Bern sneak in, but it's still not so bad because of the priority.

If we remove the priority though:

Query https://photon.komoot.io/api?q=bern:
CH, Verwaltungskreis Bern-Mittelland, Bern, city, Bern/Berne, city
CH, Bern/Berne, state, state
Bern, CH, Verwaltungskreis Bern-Mittelland, Stadtteil II, Stadtbach, Universität Bern, university, 3012, Bern/Berne, Schanzenstrasse, house
Bern, CH, Verwaltungskreis Bern-Mittelland, Stadtteil I, Rotes Quartier, Bern, station, 3011, Bern/Berne, Neuengass-Unterführung, house
US, San Bernardino, San Bernardino, city, California, city
FR, Eure, Bernay, town, 27300, Normandie, city
US, Craven, New Bern, city, North Carolina, city
IT, Cuneo, Bernezzo, village, Piemonte, city
FR, Morbihan, Berné, village, 56240, Bretagne, city
FR, Aisne, Bernot, village, 02120, Hauts-de-France, city
FR, Tarn, Bernac, village, 81150, Occitanie, city
FR, Gers, Bernède, village, 32400, Occitanie, city
FR, Gard, Bernis, village, 30620, Occitanie, city
FR, Somme, Bernâtre, village, 80370, Hauts-de-France, city
FR, Somme, Berneuil, village, 80620, Hauts-de-France, city

The results now come from all over the world.

We could remove them, but would then need another way to limit the results.

larsUE commented 7 months ago

Thanks for your tips!

Could you check autocomplete generally works, creating a new meeting with the adresses you tried?

@froger Yes, it works with proposals and meetings. Any proposals and/or meetings are also displayed properly on Decidim GEO

@Kagemaru : Where you able to successfully enter an address after removing priority & bounding box?

Kagemaru commented 7 months ago

No, as I said in the last post, it doesn't work. But I don't think the problem is in the query, because that works. It fails on validation while saving. Have you tried it now? It's online without the query parameters now.

I've just checked the logs and found this: Geocoding API connection cannot be established.

larsUE commented 7 months ago

Have you tried it now? It's online without the query parameters now.

Ah yes, sorry, I overread that. Yes, still have the same error. Except that it's more difficult to find the proper address due to the missing query. 😅

@Kagemaru If the Geocoding API connection cannot be established, maybe we need to adjust some more things in these parameters? https://github.com/puzzle/decidim-zuerich/issues/410#issuecomment-2045154437

Kagemaru commented 7 months ago

@larsUE Please try now... I've resolved the Markdown syntax URLs in the config above to real URLs and added the host as http adress instead of only the domain. I've changed and deployed it now.

Now I'll add the bounding box again and redeploy.

larsUE commented 7 months ago

It works, thanks a lot!

Kagemaru commented 7 months ago

Bounding Box is now deployed again.

larsUE commented 7 months ago

Tested again and everything works! Thanks for your great support @Kagemaru & @froger !