Giter Site home page Giter Site logo

islandora-labs / islandora_simple_map Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 7.0 1023 KB

Islandora module that adds a Google map to an object's display if the object's MODS datastream contains cartographic coordinates.

License: GNU General Public License v3.0

PHP 84.16% CSS 0.70% JavaScript 15.14%

islandora_simple_map's People

Contributors

axfelix avatar bgilhome avatar bryce-gilhome avatar mjordan avatar monkii-dev avatar whikloj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

islandora_simple_map's Issues

Make results page size configurable

For collection maps we currently grab 20 items at a pass, this was a random number I chose. This ticket is to make this a configurable variable with a default of 20.

Not working with Thesis CModel

Looks like this module doesn't work on objects with the Thesis CModel. Just to be sure, I've tried copying the geographic subject MODS directly from objects that do display a map - but no map on the Thesis.

Last commit breaks existing implementations without reinstall - warn existing users?

After the last time I pulled Islandora Simple Map, I could no longer access my Collections tab when managing a collection. Here's what I got in my log:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.islandora_simple_map_collections_map' doesn't exist: SELECT pid from {islandora_simple_map_collections_map} WHERE pid = :pid; Array ( [:pid] => doh:root ) in _islandora_simple_map_display_collection_map() (line 201 of /opt/rh/httpd24/root/var/www/drupal7/sites/all/modules/islandora_simple_map/includes/utilities.inc).

Uninstalled the module and re-enabled it, and it works fine again. I see there's a "create table" command in the Install file that was added in December, which of course doesn't get run if you're just updating the code without reinstalling.

What would be the best way to inform users that they should uninstall and reinstall if they update their code? Google group perhaps?

Better support for controlled Geographical Subjects

LoC method of writing geographical subjects is different from how Google Maps processes them. Google maps prefers "Armstrong, BC" while LoC prefers "Armstrong (B.C.)".

Because of this, Simple Map using the Geographic Subject could end up showing the wrong location. "Armstrong (B.C.)" shows a bunch of shops with the name Armstrong, whereas "Armstrong, BC" shows the correct city area.

Proposing some functionality that looks for those parentheses and turns them into commas.

Compound images get 2 maps

Due to the way compounds render as themselves and as their first child you get a map for each.

I have tested not allowing the rendering of the map when their is a islandora:compoundCModel in the $object->models. This makes only the map provided by the underlying islandora:sp_large_image_cmodel renders.

Not sure if that is okay with other users?

Not working for Book CModel?

We have Islandora Simple Map enabled on several sites in Arca, and while it works perfectly well on Basic and Large Images, the map does not display on Book objects.

Example: http://arcabc.ca/islandora/object/ufv%3A378

Configuration is with the following XPaths:

//mods:subject/mods:cartographics/mods:coordinates
//mods:subject/mods:geographic
//mods:subject/mods:hierarchicalGeographic

Metadata is present in each of the above elements, but no map is generated.

Add support for InfoWindows on markers

Again for #17 and #10 it would be nice to get a small InfoWindow with some basic information displayed as well as a link back to the Islandora object.

Depending on the use cases it could be as simple or as complex as

  • Title as a link back
  • Title as a link back, thumbnail
  • A set of whichever Solr fields you want to add and organized as you choose.

Add support for Solr field containing coordinates.

I'll need this for my collection work in #17 but it could also make #10 possible.

This task is to add a simple textfield to the admin pages.

The field should be stored in a variable and the field should use the Solr autocomplete to populate.

The Solr field can store any form of coordinates (DSM, decimal, place names, etc) and (building on the work in #25) they can be parsed to the final format after retrieval.

This Solr field would be an opt-in replacement for the built-in XPath query of the MODS record. Other hook_islandora_simple_maps_get_coordinates() implementations would still get run as per normal. Therefore this could also speed up the execution of normal maps as XPaths in MODS would not be necessary.

Alternatively, we can split up these choices and add checkboxes to the admin pages to determine whether:

  • single Islandora objects should use Solr
  • collections of Islandora objects should use Solr

To make #10 happen we would almost definitely need Solr.

Add aggregated map page?

Would be neat to generate a page that generates a map of all Islandora objects with location information, with a Solr query.

GeoJson breaks collection map markers

If you change the Output to use to pass co-ordinates to maps setting from Co-ordinates (default) to GeoJson and then view a collection map with multiple markers.

The map displays correctly but when you click on a marker you do not see the popup with the title and thumbnail image as well as the link back to the original image.

Include Administrator permission by default

Administrator is not given permission by default to configure the module, and the configure option does not appear in admin menu until the permission is checked off. Permission should be granted by default, or should accept administrator permissions bypass.

Add hook to allow custom coordinate format

Google Maps loves decimal coordinates, but if you have your data in a different format or stored using a custom way we can allow you to write a "getter" that would get the data and reformat it into the standardized way.

Google Maps does not zoom in for Maps

A collection map should zoom in to the tightest zoom level that allows all points to be seen at its initial display.

This occurs when using OpenStreetMaps but seems to not be happening for Google Maps.

Implement permission for collections with maps admin sub-tab?

I was updating documentation and I realize that if you have access to the Islandora Simple Maps admin interface you can disable anyone's collection map.

I then realized that I had half implemented this by specifying a non-existent permission to that tab.
https://github.com/mjordan/islandora_simple_map/blob/7.x/islandora_simple_map.module#L45

This task is to either change that permission to be "administer site configuration" like the others or implement the other permission?

@mjordan?

Add hook for parsing formats?

I added a hook for retrieving coordinates but even my example module still uses the MODS datastream. Then it parses the new coordinates.

Perhaps it would be better to use 2 hooks.

The existing hook_islandora_simple_map_get_coordinates(AbstractObject $object) to extract from new locations (ie. alternate datastreams) and the module provides the MODS XPath one.

Then add a new hook hook_islandora_simple_map_parse_coordinates() to allow for custom parsing functions.

This new hook would return (for example)

function example_islandora_simple_map_parse_coordinates() {
   return array(
      'match_regex' => 'a regular expression string to match against this coordinate type',
      'function' => 'the name of the function to call with the coordinate(s) as the only argument',
      'file' => 'the file in the hook implementing module to find the above function',
      'weight' => 'some way to order the parsing so more common types appear first.',
   );
}

The called function above would return a string or array of strings with one or more coordinates parsed into decimal coordinates. This would be what my example module should be called for.

So once we get an array of coordinate strings from the old hook_islandora_simple_map_get_coordinates(), we can run them through the functions returned by the new hook.

Once one matches we use that result (hence the weight ordering).

Might be overkill, but otherwise if you have multiple coordinate systems used in your MODS, you'll have multiple modules parsing your MODS for each set of XPaths just to get the results and then parse them differently.

What I'm not sure about is should we pass the full array of coordinates to the function and let it parse those it matches on or do loop through the coordinates and process each against all hook implementations in order.

thoughts?

Modularize MODS parsing to other metadata schemas and add KML support

We previously developed a module called Islandora Gmap, or Islandora Google Maps to provide functionality for automatically embedding Google Maps on Islandora object landing pages. This module was inspired by Islandora Simple Map, and at the time provided a superset of Islandora Simple Map functionality, but Islandora Simple Map has since been made an an official Islandora Labs module. Other functionality which is of use to us -- the ability to display a single map with multiple annotations from all of its child objects on a collection landing page, to serve as an alternate entry point to the collection -- has since been added to Islandora Simple Map. Because Islandora Simple Map now has a more sustainable maintenance structure, it behooves us to merge our Islandora Gmap functionality into Simple Map.

This functionality includes:

  • Modularizing the code that reads geographical coordinates out of MODS datastreams to also support DDI, or any other relevant datastream
  • Displaying KML layers on Google Maps in addition to latitude/longitude coordinates.

Accept multiple elements for geographic reference

Include in the config form additional (if not then..) options for elements that could contain a geographic reference.

Example: some objects may contain a geographic subject, but no cartographic coordinates. Others may have coordinates but no geographic subject. Module should ideally look first at one element (specified in configuration), then at another, and optionally another, etc.

Cache marker coordinates for collection maps

When displaying huge maps (like http://digital.lib.sfu.ca/islandora/object/bcp%3Acollection/maps) the system queries for all the collection coordinates each time the map is rendered.

If we can agree on a safe way to avoid revealing objects a user doesn't have permission to see, we could cache the array which should really improve performance.

In past I have used the users roles as a key for the cache. So if two users have the same roles then they can share the cache entry. This only works if you don't assign XACML permissions based on username.

Alternatively, we could just enable a cache for anonymous users and logged in users will suffer the consequences.

Map not displaying on book object

Hey @mjordan, not sure if this is your module, or something to do with the book solution pack, but I'm not able to get the map to display on any book solution pack objects.

From what I can tell, the XPath if exactly the same, and I'm not seeing anything obvious in the preprocess hook, or template files for the large image solution pack or the book solution pack that would cause the map not to display.

Two examples:

Any ideas?

Adding support for OpenStreetMap

I can't find much by way of a direct API for using OpenStreetMap similar to how this module uses Google Maps, but the HTML that needs to be generated looks like this:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.openstreetmap.org/export/embed.html?bbox=-123.38882446289061%2C49.14555903725487%2C-122.93563842773436%2C49.35353208188311&amp;layer=mapnik&amp;marker=49.24965507167121%2C-123.1622314453125" style="border: 1px solid black"></iframe><br/><small><a href="http://www.openstreetmap.org/?mlat=49.2497&amp;mlon=-123.1622#map=12/49.2497/-123.1622">View Larger Map</a></small>

The difficulty in assembling this markup is computing the bbox values from the lat/long. A Perl implementation of how to do this is available on the OSM wiki.

Make this a block?

Hello @mjordan, I am back to steal more of your wonderful code.

We are migrating a Public Art project, which I built using HTML and javascript many years ago. http://umanitoba.ca/libraries/units/archfa/art_tour/

My idea is to have a map on the collection page that aggregates the points from the items in the collection. For this I thought a block might be better.

I'm gonna fork this and I'll try to not move to far away from your existing implementation.

Move variables with _mapS to _map

This is my fault (again), but I added two variables with islandora_simple_maps_*.

This task is to:

  1. Change the variable name in all locations.
  2. Add a hook_update_N task to:
    1. migrate the old variable (with S) to the new (without S) variables.
    2. Uninstall the old incorrect (with S) variables.

Handle repeated geocoordinate values in one field better

For example, http://digital.lib.sfu.ca/alping-460/niut-range-camp-ridge-north-camel-mountain-aug-22-1967 has two sets of geocordinates in one element:

<cartographics>
<coordinates>+51.585,-124.71722; +51.52333,-124.97861</coordinates>
</cartographics>

In cases like this, we should give admins the choice of whether to not render a map, or to render a map showing only the first coordinate. We probably need to give the admin an option to define what characters to separate repeated coordinate on

Display the points from all objects in a collection

This needs to pull the entries from Solr because parsing each MODS would be too crazy. Either that or aggregate the points from all the child objects into the Collections MODS record?

I'm thinking only one level deep, again it would be too crazy otherwise. Not sure how to determine specify that a collection should display the map or not? Perhaps make it another block, then the inherent (Show block on specific pages) config can be used?

My use case is migrating this Public Art map (http://umanitoba.ca/libraries/units/archfa/art_tour/) to Islandora. So I think I will also need to be able to create custom info windows, but that may have to be discussed with the collection owner.

If anyone else has a use case, please add it in and I'll keep it in mind when I am working on this.

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.