Neatline styles map-zoom/map-focus

I just refreshed all of my content, which means re-creating all of my Neatline Exhibits. A problem I've run into is that setting

.all {
   map-zoom:8;
}

Does set the zoom to 8 in the styles tab, but when clicking on Waypoints, the map still zooms in to 21. (Even if I only have 15 zoom levels set for the map.)

Is there a way to override this behavior? I reaaally don't want to have to click "Use current view" for each individual item.

Hi Sheepeeh,

Do you have access to the database? If there's a lot of this stuff what I would personally do is get a dump and update the items in the database with SQL.

I think what's going on is that the JavaScript is overriding this configuration in the CSS and making it misbehave (or not the way you intend)...

Wayne

I _do_ have access to the database, but hadn't looked at the records table much because it's huge and scary. What do you suggest I change? The coverage is printing as nonsense characters, so I can't use that to set the map-focus, and the map-focus is listing as NULL. Here's an example selection, all records have WKT and appear as points on the map.

+-----+----------+---------+------------+-------------+--------+----------------------+------+-----------+--------------+--------------+--------------+--------+--------+-------------+-------------+------------+----------+----------+----------+-----------+
| id  | owner_id | item_id | exhibit_id | is_coverage | is_wms | coverage             | tags | widgets   | presenter    | stroke_width | point_radius | zindex | weight | point_image | wms_address | wms_layers | min_zoom | max_zoom | map_zoom | map_focus |
+-----+----------+---------+------------+-------------+--------+---------------------------+------+-----------+--------------+--------------+--------------+--------+--------+-------------+-------------+------------+----------+----------+----------+-----------+
| 562 |        1 |    2857 |         21 |           1 |      0 |   X▒f▒]▒▒()▒▒     UA | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 563 |        1 |    2858 |         21 |           1 |      0 |    ▒3$▒e▒ni▒9▒%LA    | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 564 |        1 |    2862 |         21 |           1 |      0 |   ▒▒H▒[
▒^▒▒▒▒QA     | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 565 |        1 |    2905 |         21 |           1 |      0 |   _▒▒▒̶a▒"CZMA        | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 566 |        1 |    2960 |         21 |           1 |      0 |   ▒$▒c1▒^▒i▒-▒▒▒TA   | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 567 |        1 |    2961 |         21 |           1 |      0 |                      | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 568 |        1 |    2973 |         21 |           1 |      0 |   S6▒>AK8▒4▒▒[A      | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 569 |        1 |    2975 |         21 |           1 |      0 |   û\▒6▒i▒yQ-▒TA      | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 570 |        1 |    2986 |         21 |           1 |      0 |   8▒▒cgi▒*p▒▒QA      | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
| 571 |        1 |    2992 |         21 |           1 |      0 |   û\▒6▒i▒yQ-▒TA      | NULL | Waypoints | StaticBubble |            2 |           10 |   NULL |   NULL | NULL        | NULL        | NULL       |     NULL |     NULL |     NULL | NULL      |
+-----+----------+---------+------------+-------------+--------+---------------------------+------+-----------+--------------+--------------+--------------+--------+--------+-------------+-------------+------------+----------+----------+----------+-----------+

Yeah, coverage is a special snowflake (it's a serialized WKT to speed up spatial queries).

You should be able to set the map_zoom to the zoom level you want. Something like this:


UPDATE omeka_neatline_records
SET map_zoom = 8
WHERE exhibit_id = 21

This will take care of the zoom level, but don't take care of where to look, which can be a bit trickier, but is basically the center point.

Do you have your old exhibit by any chance? The ids for the records are probably different if you're starting from scratch, but you may be able to match on the title and exhibit ids to update the table without having to rekey everything.

HTH,
Wayne

So if I'm interpreting this correctly, map-zoom has no effect unless the map-focus is explicitly set.

I'll attempt to skirt around that by using the WKT value to set the focus, but it seems like map-zoom should control the zoom-level of the default focus, as well.

The map_zoom will set the zoom level, but the default location is to either be "null island" off the coast of Africa or use the browser's current location. We have to keep this separate from the actual geometry since you can have multiple, complex shapes.

That said, if you have "simple" shapes, you could use the centroid function if you're using polygons (if it's just a point, you can just use those coordinates).

The syntax for this is really horrible:


-- for a point
SELECT AsText(GeometryN(GeomFromText(AsText(coverage)), 1)) FROM omeka_neatline_records where id = 562;

-- for geometry
SELECT AsText(centroid(GeometryN(GeomFromText(AsText(coverage)), 1))) FROM omeka_neatline_records where id = 571;

You may need to clean up a bit with substring() or regexp() in the select to get just the properly formatted point.

Make sense?

Wayne

Makes sense (maybe I'll convert from points to polygons), but then where do Waypoint items get the coordinates to zoom to? Clicking goes to the correct location, just the wrong zoom level.

Now that's curious; waypoints should use the zoom_level for the record.

What theme are you using? Is there a public URL?

Sent you an email :)
We're using a modified version of Berlin, but very little of our customization has to do with Neatline.

Just to close this loop a bit for everyone else, there is an issue in setting the map view if the focus and zoom levels are not set. There is a ticket (https://github.com/scholarslab/Neatline/issues/301), but a work around for this (if you have access to the database) is to set these values using values from the coverage field.


UPDATE omeka_neatline_records
SET map_focus = concat(X(coverage), ', ', Y(coverage))
, map_zoom = 8
WHERE exhibit_id = 21;

I also posted this as a gist.

This works great if your coverage is a POINT, but more testing would be needed for more complex geometry collections.

Just tried this and it works like a charm. Thanks, Wayne!

So, if you want to set a default center and zoom level for a Neatline exhibit you need to run to do this at the database level?

You can set the default zoom through styles, but if you don't have a focus specifically assigned to the record, Waypoints won't respect the zoom. If you do have a focus defined, setting the zoom level should work.