After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778794 - Loading GeoJSON doesn't work
Loading GeoJSON doesn't work
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: map view
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2017-02-16 22:01 UTC by Mattias Bengtsson
Modified: 2017-03-09 20:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
geoJSONShapeLayer: Add additional mime type (960 bytes, patch)
2017-03-08 20:02 UTC, Marcus Lundblad
committed Details | Review

Description Mattias Bengtsson 2017-02-16 22:01:48 UTC
As part of checking that a patch I made didn't break gnome-maps I found that the GeoJSON from the following URL didn't load: 
http://thematicmapping.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20nz_tour&format=geojson

With MAPS_DEBUG=1 I get this:

Gjs-Message: JS LOG: MapView<.openShapeLayers/<@resource:///org/gnome/Maps/js/mapView.js:260
MapView<.openShapeLayers@resource:///org/gnome/Maps/js/mapView.js:271
wrapper@resource:///org/gnome/gjs/modules/lang.js:178
LayersPopover<._onLoadLayerClicked/<@resource:///org/gnome/Maps/js/layersPopover.js:127
main@resource:///org/gnome/Maps/js/main.js:47
run@resource:///org/gnome/gjs/modules/package.js:192
start@resource:///org/gnome/gjs/modules/package.js:176
@/usr/bin/gnome-maps:5
Comment 1 Mattias Bengtsson 2017-02-16 22:27:31 UTC
Going a bit deeper:
If I change shapeLayer.js:newFromFile to:

  function newFromFile(file, mapView) {
      let contentType = Gio.content_type_guess(file.get_uri(), null)[0];
      log("contentType:" + contentType);
      log("SUPPORTED_TYPES: " + JSON.stringify(SUPPORTED_TYPES));
    
I get this in the logs:
  Gjs-Message: JS LOG: contentType:application/geo+json
  Gjs-Message: JS LOG: SUPPORTED_TYPES: [null,null,null]

So SUPPORTED_TYPES doesn't seem to get initialized properly.
Comment 2 Jonas Danielsson 2017-02-17 06:37:00 UTC
The fixing of how we loop through supported_types in your other bug does not fix this? Changing for for (x in y) { } ...
Comment 3 Mattias Bengtsson 2017-02-17 21:19:14 UTC
No it doesn't I'll see if I can't look a bit closer on this now.
Comment 4 Marcus Lundblad 2017-03-08 10:11:48 UTC
The strange thing is that it seems to get an array filled with nulls there, and opening .gpx files _does_ work. Will need to try doing that with this debug logging turned on.
Comment 5 Marcus Lundblad 2017-03-08 20:02:00 UTC
Created attachment 347500 [details] [review]
geoJSONShapeLayer: Add additional mime type

It seems GeoJSON files are identified by later
versions of the mime type database as
application/geo+json.
So add this type to the supported ones for the
shape layer implementation.
Comment 6 Zeeshan Ali 2017-03-09 09:52:30 UTC
Review of attachment 347500 [details] [review]:

Patch itself looks good but nitpicks on commit log (mostly for furture reference):

* instead of "additional", let's specify the mimetype. To keep the shortlog short still, I'd sacrifice on module prefix instead.

* Would be nice if we don't break the lines early (before 74 chars) just to start new sentences. It only unnecessarily makes the `git log` output longer and looks weird.