"Image Locate" possible with OSM?

I'm using Image Locate=Google. Wouldn't it be possible to use Open Street map instead?

Adding Image LOCATE=osm should not be a big deal for the developers. Until it's done, you can use a little script:

function OnClick(clickData)
{
    var zoomlevel = 12;
    var cmd = clickData.func.command;
    cmd.deselect = false; // Prevent automatic deselection

    for (var eSel = new Enumerator(clickData.func.sourcetab.selected); !eSel.atEnd(); eSel.moveNext())
    {
        var fileItem = eSel.item();
        if (!fileItem.is_dir)
        {
            var fileMeta = fileItem.metadata;
            if (fileMeta == "image")
            {
                var imageMeta = fileMeta.image;
                var latitude = imageMeta["latitude"];
                var longitude = imageMeta["longitude"];

                if (typeof latitude == "number" &&
                    typeof longitude == "number")
                {
                    cmd.ClearFiles();
                    cmd.RunCommand("https://www.openstreetmap.org/#map=" + zoomlevel + "/" + latitude + "/" + longitude + "/");
                }
            }
        }
    }
}

Adjust zoomlevel to your taste.

Locate Images in OSM.dcf (2.1 KB)

1 Like

Wouldn't mind if it happened directly in Caltopo either, since CalTopo can access a whole bunch of different map sets including Google's, OSM, Forest Service topos, a few other topos, etc – and on top of that actually LAYER these maps painlessly and give access to some other useful features.

https://caltopo.com/

https://mappingsupport.com/ also does some useful things like that.

lxp, thanks, it works! Is there a way to include something like a cross hair to mark the exact point? Anyway, with zoom level 22 it works quite well already.

Yes, there is a marker available. Replace line 23 with this one.

cmd.RunCommand("https://www.openstreetmap.org/?" + "&mlat=" + latitude + "&mlon=" + longitude + "#map=" + zoomlevel + "/" + latitude + "/" + longitude + "/");

Locate Images in OSM2.dcf (2.2 KB)

1 Like

Try this.

Locate Images in CalTopo.dcf (2.1 KB)

Unfortunately I haven't found a way to pass any other information but coordinates and zoomlevel.

2 Likes

Thanks again, that's very cool! Much better now, because OSM has more map details. :clap:

In the next update we'll make the list of location services configurable.

2 Likes

That's great, thanks!

Here is a bit firm lxp's code, which did the trick:

cmd.RunCommand("https://www.openstreetmap.org/?" + "&mlat=" + latitude + "&mlon=" + longitude + "#map=" + zoomlevel + "/" + latitude + "/" + longitude + "/");

Maybe this line contains the code in question? However, i can't figure, how to include the important part into the miscellaneous setting. Any tip?