omeka-s-modules / Mapping

GNU General Public License v3.0
8 stars 8 forks source link

Testing: Add GeoJSON to mapping blocks #120

Open jimsafley opened 6 months ago

jimsafley commented 6 months ago

~The map-by-geojson-block branch introduces the "Map by GeoJSON" block layout. Page builders can now add maps to their pages using GeoJSON instead of geocoded items.~

The map-by-groups-block-plus-optimization branch introduces a way for page builders to add features to their maps using GeoJSON.

To test this feature, ~add a "Map by GeoJSON" block layout to a page,~ enter any GeoJSON to a "Map by" block, save the page, and view the resulting map on the public page. You can find many GeoJSON examples online. A helpful source I use is the List of open GeoJSON datasets on the Open Innovations website.

In addition to the normal "Default view" and "WMS overlays" sections, the block layout includes a "GeoJSON" section that has several fields:

To understand the first three inputs, it's important to note that GeoJSON often contains a list of properties, which are just arbitrary key/value pairs that describe a geolocated feature. So if there's a "Title" property for every feature, the user could enter "Title" in the Label property key field, and that will be the feature's popup label.

allanaaa commented 3 months ago

This appears to work at a basic level:

Screenshot 2024-07-31 at 13 26 24

1) I found the admin side obtuse and it took some experimenting to figure out what all this meant. Help text could be more like

2) "Enter the GeoJSON" - could users also have the option to paste in a link to scrape, instead of manually copy-pasting this content? Or is the assumption users will more likely be putting in their own work from a local file?

3) Can a user enter in multiple chunks of geoJSON here? If I wanted to combine 2 or more of the datasets from that link, can I just copy-paste them all in succession and have them all display on one map?

4) Might there be any geoJSON in the world that sends media to display in the pop-up? Is that possible?

allanaaa commented 3 months ago
  1. Is there a way to incorporate Omeka items into the same map with the geoJSON? Could a user combine non-item features with item features using geoJSON code? Or would we need to add more fields to do a query or attachments?
allanaaa commented 3 months ago
  1. Could we incorporate any error messages here? Soemthing that validates the inputted code when you save the page, maybe? I did a few straight copy-pastes from your source and with some code the map wouldn't load on the public page.
jimsafley commented 3 weeks ago

I've integrated the GeoJSON feature into the "Map by attachments" and "Map by query" block layouts. It is now ready for testing in the map-by-groups-block-plus-optimization branch. You may delete the map-by-geojson-block branch, but we'll continue discussing the feature on this issue.

jimsafley commented 3 weeks ago

"Enter the GeoJSON" - could users also have the option to paste in a link to scrape, instead of manually copy-pasting this content? Or is the assumption users will more likely be putting in their own work from a local file?

I see the potential value, but it's probably a feature for a future release. For now the assumption is users will be entering in the GeoJSON themselves.

Can a user enter in multiple chunks of geoJSON here? If I wanted to combine 2 or more of the datasets from that link, can I just copy-paste them all in succession and have them all display on one map?

I think it's reasonable to only accept one dataset at a time. The benefits don't outweigh the additional complexity of allowing an indefinite amount of datasets. Users can always combine them by hand. Maybe for a future release.

Might there be any geoJSON in the world that sends media to display in the pop-up? Is that possible?

Possibly, but until we have a real use case from someone using this feature, we don't have much to go on.

Is there a way to incorporate Omeka items into the same map with the geoJSON? Could a user combine non-item features with item features using geoJSON code? Or would we need to add more fields to do a query or attachments?

A good idea. I've implemented this. Look at the "GeoJSON" section in the "Map by attachments" and "May by query" block layouts.

Could we incorporate any error messages here? Soemthing that validates the inputted code when you save the page, maybe? I did a few straight copy-pastes from your source and with some code the map wouldn't load on the public page.

Validating GeoJSON client-side is tricky. Perhaps just validating for JSON would catch most errors. I'll look into it.

allanaaa commented 2 days ago

In both the Query and Attachments blocks, you've got "Label property key" twice - the second one should be "Comment property key" instead I think.

Screenshot 2024-11-05 at 09 42 53
allanaaa commented 2 days ago

Is there any way of displaying the geoJSON pins/clusters differently than our Omeka items? Maybe just different colour profiles for each?

jimsafley commented 2 days ago

In both the Query and Attachments blocks, you've got "Label property key" twice - the second one should be "Comment property key" instead I think.

Oops. Fixed.

Is there any way of displaying the geoJSON pins/clusters differently than our Omeka items? Maybe just different colour profiles for each?

We plan to make feature styles configurable in a future release, so this will have to wait.

allanaaa commented 1 day ago

1) Both the Query and Attachments blocks aren't loading their selected basemaps. The site-wide basemap setting is working when used, but individual maps won't. (The chosen basemaps are showing on the admin side for each block, though.)

2) I thought Timeline and geoJSON were working fine together (noted in the docs that geoJSON items won't appear on the timeline). ~But I think that usually when you scroll through the timeline, the map zooms in all the way to the feature of the individual item in focus? It's not doing that right now.~ Ah, I see, the "Fly to: Default view" isn't the item's "default view", it's whatever the map originally loaded with. Maybe there's a better term for that. http://dev.omeka.org/amayer/amayer-s/omeka-s/s/my-omeka-s-site/page/maps-test

allanaaa commented 1 day ago
  1. These coloured blobs when the timeline-based map starts zooming in (with the "fly to" set to something high) aren't ideal.

https://github.com/user-attachments/assets/e1de6131-1167-4cd2-afa8-99a07404efc6

jimsafley commented 1 day ago

Both the Query and Attachments blocks aren't loading their selected basemaps. The site-wide basemap setting is working when used, but individual maps won't. (The chosen basemaps are showing on the admin side for each block, though.)

It should be fixed now. The block's basemap provider should take priority over the site's basemap provider.

I thought Timeline and geoJSON were working fine together (noted in the docs that geoJSON items won't appear on the timeline).

Yes, the GeoJSON features will only appear on the initial map, before the user navigates to individual events. I don't expect many users will add GeoJSON when using a timeline.

These coloured blobs when the timeline-based map starts zooming in (with the "fly to" set to something high) aren't ideal.

Yes, that's not ideal. Perhaps it'll get fixed in a later release.