GithubHelp home page GithubHelp logo

blacklight-maps's People

Contributors

cbeer avatar ebenenglish avatar jcoyne avatar mejackreed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blacklight-maps's Issues

Refactor #show_map_div to match Rails tag rendering conventions

To give our consumers additional flexibility, I'd adjust this method signature to something like:

def blacklight_map_tag id, tag_options = {}, &block
  ...
  content_tag(:div, { id: id  data: ...}.deep_merge(tag_options), &block)
end

This (sorta) mirrors the regular #content_tag signature, and allows the caller to add additional attributes and the like to this div.

initialview config property not working

I tried to set the initialview property in my CatalogController:

config.view.maps.initialview = [[27.741885,-96.987305],[37.874853,-71.279297]]

But that didn't take. So I looked around and saw that the data attribute wasn't being set like the other config settings were:

From _index_mapview.html.erb

<%= blacklight_map_tag('blacklight-index-map', {data:{searchcontrol: true, catalogpath: search_catalog_path, placenamefield: blacklight_config.view.maps.placename_field, clustercount:'hits', searchresultsview: default_document_index_view_type }}) %>

So I added the initalview to the data hash

<%= blacklight_map_tag('blacklight-index-map', {data:{searchcontrol: true, catalogpath: search_catalog_path, placenamefield: blacklight_config.view.maps.placename_field, clustercount:'hits', searchresultsview: default_document_index_view_type, initialview: blacklight_config.view.maps.initialview }}) %>

...and changed the config value to a string rather than an array...

config.view.maps.initialview = '[[27.741885,-96.987305],[37.874853,-71.279297]]'

And the config setting now works as expected.

Perhaps I am missing something, but I thought it would be helpful to point this out!

replace facet_by_field_name with aggregations

To fix a deprecation warning:

DEPRECATION WARNING: facet_by_field_name is deprecated 
and will be removed from a future release (use aggregations instead). 
(called from map_facet_values at /blacklight-maps/app/helpers/blacklight/blacklight_maps_helper_behavior.rb:65)

The blacklight dependency for this fix must be >= 5.12, since the aggregations method was introduced with this release.

refactor #render_geojson

I don't see where we're using the index counter. Maybe it's vestigial?

We can also use #map to create the features array directly, e.g.:

{type: "FeatureCollection", features: @response.docs.map { |doc| ... }.compact }.to_json

map doesn't zoom to bounds if only feature is a bbox

There is an issue with setMapBounds() in blacklight-maps-browse.js where the bounds are set to the default ([[90, 180], [-90, -180]]) if the only item in the GeoJSON FeatureCollection is a bounding box, rather than setting the bounds to the dimensions of the bbox.

Incorrect bounds for bbox only:
incorrect bounds for bbox only

It should look like this:
correct bounds for bbox only

This is because markers._featureGroup._layers (https://github.com/projectblacklight/blacklight-maps/blob/master/app/assets/javascripts/blacklight-maps/blacklight-maps-browse.js#L185) returns an empty object when the only item is a bounding box (which is definitely a bit surprising), so hasAnyFeatures() returns false.

Would suggest either:

Default bounds returned by getBounds() when there are no features:
default bounds when there are no features

B is probably the easier solution, but A could easily be done if we want to preserve the [[90, 180], [-90, -180]] default bounds feature. Something like this seems to work:

/**
* Checks to see if there are any features in the markers MarkerClusterGroup
*/
function hasAnyFeatures() {
  var has_features = false;
  markers.eachLayer(function (layer) {
    if (!$.isEmptyObject(layer)) {
      has_features = true;
    }
  });
  return has_features;
}

Invalid GeoJSON object

I'm updating sul-dlss/spotlight-maps_of_africa (which uses the placename_coords feature). I've added configuration like this:

    config.view.maps.type = "placename_coords"
    config.view.maps.placename_coord_field = 'placename_coords_ssim'

But when I go to the map view, I get this js error:

Uncaught Error: Invalid GeoJSON object. leaflet.js?body=1:6224
L.extend.geometryToLayer leaflet.js?body=1:6224
L.GeoJSON.L.FeatureGroup.extend.addData leaflet.js?body=1:6133
L.GeoJSON.L.FeatureGroup.extend.initialize leaflet.js?body=1:6110
L.Class.extend.NewClass leaflet.js?body=1:230
L.geoJson leaflet.js?body=1:6382
(anonymous function) blacklight-maps-browse.js?body=1:44
jQuery.extend.each
geometry.type // => "FeatureCollection"

Any ideas?

release for blacklight >=7.0, < 7.8

Due to some substantial changes with rendering constraints in Blacklight 7.8, it makes sense to have separate versions of blacklight-maps to support compatibility with pre/post 7.8 blacklight.

The v1.1.0 release supports >= 7.8.

We need make a release for >=7.0, < 7.8, which should be tagged as v1.0.0.

This should be fairly easy, almost all the v1.1.0 code should work, except for a few methods in RenderConstraintsOverride that will need to be tweaked.

show bbox bounds on hover

In catalog#index and catalog#map views, bboxes are displayed as points. It would be cool if when the user hovers over a point that's from a bbox, the bounds are shown. (Similar to how clusters show bounds on hover.)

Not sure to what extent this is possible with current Leaflet or Leaflet MarkerCluster methods/config settings.

Use blacklight document rendering methods to render the sidebar partials

I think/hope the render_leaflet_sidebar_partial call can be replaced with something like:

render_to_string(doc) # not sure if render_to_string supports this short-hand.. but it'd be awfully nice if it did.

Obviously, if we delegate most of the geojson to the model, we'll have to have some way to pass or merge the html into the block..

Is there sample data?

Is there some sample data that I can import into my dev SOLR instance for development purposes?

move add_spatial_search_to_solr method to a Blacklight::SearchBuilder subclass module

To comply with deprecation warnings caused by Blacklight 5.10.* about building search params by calling methods directly on CatalogController.

Beginning with this fix, we may need to start indicating in the documentation which versions of blacklight-maps work with which versions of Blacklight. The dependency should of course be set in blacklight-maps.gemspec, but some info in the README might be useful for implementers.

incompatibility with Blacklight >= 5.16.0

When attempting to use blacklight-maps v0.4.0 with blacklight >= 5.16.0, you get an error uninitialized constant Blacklight::Configuration (NameError) when starting your application.

Here's the full trace:

/home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps/engine.rb:9:in `<class:Engine>': uninitialized constant Blacklight::Configuration (NameError)
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps/engine.rb:7:in `<module:Maps>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps/engine.rb:6:in `<module:Blacklight>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps/engine.rb:5:in `<top (required)>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps.rb:7:in `require'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps.rb:7:in `<module:Maps>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps.rb:4:in `<module:Blacklight>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/blacklight-maps-0.4.0/lib/blacklight/maps.rb:3:in `<top (required)>'
    from /home/username/boston-library/commonwealth-vlr-engine/lib/commonwealth-vlr-engine/engine.rb:4:in `require'
    from /home/username/boston-library/commonwealth-vlr-engine/lib/commonwealth-vlr-engine/engine.rb:4:in `<top (required)>'
    from /home/username/boston-library/commonwealth-vlr-engine/lib/commonwealth-vlr-engine.rb:1:in `require'
    from /home/username/boston-library/commonwealth-vlr-engine/lib/commonwealth-vlr-engine.rb:1:in `<top (required)>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
    from /home/username/boston-library/Commonwealth-public-interface/config/application.rb:5:in `<top (required)>'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/username/.rvm/gems/ruby-2.2.1/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:8:in `require'
    from bin/rails:8:in `<main>'

Blacklight::Maps::Engine attempts to set some default configuration settings, which is what causes the error.

(In 5.16.0, the Blacklight::Configuration module was moved to app/models/blacklight/configuration.rb.)

There may be other issues related to using Blacklight >= 5.16.0, but this one is a major blocker to further work on bringing this project up to date with Blacklight 6.

@mejackreed @cbeer any ideas on where to move the default configuration stuff?

coordinate search constraints should show in page title

When I am on a page with a map (catalog#map, catalog#index map view, etc.)
And I click on a coordinate point or use the search tool on the map
I should see the coordinate search constraints in the page title in the browser window

Blacklight::CatalogHelperBehavior#render_search_to_page_title (from projectblacklight/blacklight@47eab51) adds functionality to display search constraints in the page title on catalog#index views. Coordinate search constraints are not displayed, since there is no provision in that method to display them.

We need to add methods to BlacklightMaps::RenderConstraintsOverride to add functionality to include coordinate constraints in the page title.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.