Opened 6 years ago

Last modified 3 months ago

#2083 reopened task

map content integration not working on osgeo.org

Reported by: jive Owned by: webcom@…
Priority: normal Milestone: Website Redesign 2024
Component: WebSite Keywords:
Cc:

Description

I am not quite sure how integration was done between open layers and word-press for the maps on osgeo.org but it is broken:

  1. https://www.osgeo.org/initiatives/geo-for-all/ - should list labs from https://www.osgeo.org/geo-for-all-labs/
  1. https://www.osgeo.org/community/members/ use the filter dropdown to toggle on the map, should list members visually.

Attachments (1)

openstreetmpa.php (6.7 KB ) - added by jive 6 years ago.

Download all attachments as: .zip

Change History (17)

comment:2 by jive, 6 years ago

Reached out to open layers team:

I tried to debug the map, but it's impossible to gain any insight from the minified code. I did see that the geometries are created correctly, but there are some strange variable assignments for the cluster source which I cannot make sense of in the minified code.

Reaching out to Get Interactive to try and find original non-minified map.

Last edited 6 years ago by jive (previous) (diff)

by jive, 6 years ago

Attachment: openstreetmpa.php added

comment:3 by robe, 6 years ago

Jody,

is the attached the patch and is that the name of the file, looks like map is spelled wrong.

comment:4 by jive, 6 years ago

That is fine I cut and pasted it it out of the git repo to share it here (since the repo is private and open layers team was unable to see it).

Here is a summary of email exchange:


Jody:

Found it - https://git.osgeo.org/gitea/osgeo/wordpress/src/branch/master/wp-content/themes/roots/templates/openstreetmap.php


Andreas:

That source code did not help, but I found the issue. It's a data problem. There is a lab without a location:

            labTitle: "Comunidad gvSIG Uruguay"
            locationTitle: "Montevideo"
            pageUrl: "https://www.osgeo.org/geo-for-all-labs/comunidad-gvsig-uruguay/"

lat and lng are null, but any item added to the map as feature requires either a geometry with valid coordinates, or no geometry at all.

The problem is in the updateMarkers function. It should start with

            var markers = [];

            for (var i = 0; i < items.length; i++) {
                var currentItem = items[i];

                if (currentItem.locations) {
                    for (var j = 0; j < currentItem.locations.length; j++) {
                        var lat = parseFloat(currentItem.locations[j].lat);
                        var lng = parseFloat(currentItem.locations[j].lng);
                        if (isNaN(lat) || isNaN(lng) { continue }

The last line is the one that needs to be added.

Last edited 6 years ago by jive (previous) (diff)

comment:5 by jive, 6 years ago

What is the process for applying the above patch to the repo?

comment:6 by robe, 6 years ago

It's just manual at moment. I can apply it for now and then create a new branch with latest

comment:7 by robe, 6 years ago

Okay I fixed, the above snippet wasn't complete, was missing a close ) and had to add the same logic to the currentItem.location section.

https://www.osgeo.org/initiatives/geo-for-all/

I committed changes to this branch https://git.osgeo.org/gitea/osgeo/wordpress/src/branch/openlayers-fix-broken-location and deployed.

The diff with the master looks like this.

@@ -126,6 +126,7 @@

                     for (var j = 0; j < currentItem.locations.length; j++) {

                         var lat = parseFloat(currentItem.locations[j].lat);

                         var lng = parseFloat(currentItem.locations[j].lng);

+                       	if (isNaN(lat) || isNaN(lng) ) { continue }

 

                         markers.push(new ol.Feature({

                             type: 'icon',

@@ -138,7 +139,7 @@

                 } else if (currentItem.location) {

                     var lat = parseFloat(currentItem.location.lat);

                     var lng = parseFloat(currentItem.location.lng);

-

+                    if (isNaN(lat) || isNaN(lng) ) { continue }

                     markers.push(new ol.Feature({

                         type: 'icon',

                         geometry: new ol.geom.Point(convertGoogleMapCordsToOpenLayerCords(lat, lng)),

I'm going to tag master later as first release we had and then create another branch that reflects current code. Plugins have been updated etc, so what is master is not quite what we are running with.

comment:8 by robe, 6 years ago

Resolution: fixed
Status: newclosed

comment:9 by jive, 6 years ago

Resolution: fixed
Status: closedreopened

Not all maps are working yet, see original description at the top of the page.

comment:10 by robe, 6 years ago

Jody,

Looking at the openstreetmap.php file, I don't think that controls the members map. I'm not sure what does. The openstreetmap.php only seems to reference geoforall.

I thought originally it was lack of long / lats missing, but I see it working on osgeo.getinteractive.nl

and it also seems to work on https://staging2.www.osgeo.org/community/members/ (well I see a map anyway with points).

I'll reload the staging2 data from production tomorrow to see if I can replicate the failure.

The difference with production and staging 2 are

staging2 is running php7, produciton php5 staging2 is MariaDb 10.1 (and I also converted all the tables to utf8mb4), production still has mostly latin formatted tables.

staging2 data is about 2weeks ago snapshot of production.

comment:11 by robe, 6 years ago

I restored backup from last night onto staging2. And now staging2 is exhibiting the same issue as production with the member map page not showing any points.

I then applied my utf8mb fix just to make sure that wasn't the difference and it was still broken.

So whatever broke member map was probably recent member data added from within past 2 weeks.

comment:12 by robe, 6 years ago

GI made same changes to members related file and committed fix to repo (files used by members map were different)

roots/assets/vue/item-map.vue roots/assets/js/bundle.js

I put the changes in production and see the map icons now on members

https://www.osgeo.org/community/members/

comment:13 by robe, 6 years ago

Resolution: fixed
Status: reopenedclosed

comment:14 by jive, 6 years ago

Resolution: fixed
Status: closedreopened

Integration is still not working:

  1. Members map shows one user for Mexico
  2. Mexico has several users, one in Mexico (country) and on win Mexico (country) --> Mexico (city)

comment:15 by robe, 6 years ago

That sounds like it might be a data issue, like not all cities are geocoded. I didn't check to see where it is pulling the lon/lats from but I assume it must be in one of the location tables.

comment:16 by robe, 3 months ago

Milestone: Website rebranding 2017Website Redesign 2024

The geoforall looks okay here, but the members one still seems broken.

I'm moving to Website Redesign 2024, but may be better under a SAC contract a dedicated contract

Note: See TracTickets for help on using tickets.