Page MenuHomePhabricator

Allow kartographer to display image overlays
Open, MediumPublicFeature

Description

Commons has a lot of maps, aerial images etc. many of them have an overlay KML files associated with it. For example File:Warsaw Ghetto Map - 1940-10-15a.png
has File:Warsaw_Ghetto_Map_-_1940-10-15a.png/overlay.kml associated with it which can be accessed through this link.

It would be great if we could do the same by overlaying in top of Kartographer OSM maps. KML requires 4 corner coordinates, however what is often easier to get are 3+ anchor points (lat/lon + row/col) , which can be used to calculate corner points. Also /overlay.kml "sub" pages in image namespace are not well supported by current software, since file namespace does not support subpages. If we continue to use subpages we should allow them.

Next step would be an interactive software to add anchor points.

Event Timeline

Restricted Application added subscribers: Poyekhali, Aklapper. · View Herald Transcript
debt triaged this task as Medium priority.Nov 16 2016, 5:13 PM
debt added a subscriber: debt.

This is very similar to the request in T144152 and will probably need T28059 to be resolved before either one of these related tasks can be taken on.

Technically doing this should be relatively simple in Kartographer. Moreover, you can already do something similar in Graphs as demonstrated by Street map template -- see Australia example.

We could use this kind of Kartographer's configuration:

{
  "type": "ExternalData",
  "service": "image",
  "file": "File Name.jpeg",
  "coordinates":  ... // Data needed to position the image on top of the map
}

This is very similar to the request in T144152 and will probably need T28059 to be resolved before either one of these related tasks can be taken on.

I am not fixated on KML file format, only on the final outcome. I am afraid that if we do not get 100% of KML to work T28059 will not be completed, but here I care only about tiny fraction of KML capabilities. I actually prefer to work with "anchor points" (lat/lon + row/col) and not corner coordinates required by KML.

@Jarekt what would be the best way for users to specify anchor points in JSON? Could you modify my JSON example from above?

@Jarekt what would be the best way for users to specify anchor points in JSON? Could you modify my JSON example from above?

{
"type": "ExternalData",
"service": "image",
"file": "File Name.jpeg",
"transparency": 0.5,
"anchorPoints": [ // Data needed to position the image on top of the map

  {
     "row": 23,
     "column": 56,
     "latitude": 23.001,
     "longitude": -70.99
 },
 {
     "row": 123,
     "column": 562,
     "latitude": 24.001,
     "longitude": -72.99
 },
 {
     "row": 223,
     "column": 356,
     "latitude": 25.001,
     "longitude": -72.99
 },
 {
     "row": 323,
     "column": 576,
     "latitude": 23.001,
     "longitude": -73.99
 }
]

}

You can find an example code for working with anchor points and converting them to corner coordinates c:Commons:Geocoding/Overlay. I think the minimum number of anchor points is 3 and there is no maximum. The more you have them the more accurate the fit.

The reason to work with anchor points is that if you have an aerial image or a map with approximate location than the easiest way to overlay it is to find anchor points where you identify the same point on the image and get row+column, and find the same point on the map and get latitude and longitude. From those you can calculate corner points or whatever else you need to rotate and stretch the image before plasing it on top of the map

Just some thoughts from thinking about this earlier:

  • First, KML files have been long considered unsafe, I guess another format will be better.
  • Is the idea to save the raw data for creating transformations for a bitmap layer, or create a more lightweight way of overlaying a rectangular layer (with an already transformed image)?
  • For transformations to happen they need additional data about the algorithm and interpolation, and they have to be processed.

But it will be good if such transformation control points can be saved from and for the Wikimaps Warper. Then I would consult @Chippyy to ask what kind of data would be most useful.

@Susannaanas, I'm not sure what would be the best place for the image transformation. On one hand, client-side transforms would use more battery/cpu on all devices, on the other, depending on the technology stack, it might be easier to do, and might be significantly less data to download. As for transformation data (anchor points) - it might be easier to store them inside the GeoJSON, but it might be more portable to store it separately in Wikibase store.

TheDJ changed the subtype of this task from "Task" to "Feature Request".Mar 8 2020, 11:50 PM