The View In button lets you leave Topo Maps 2 to view an area in another map app.
By default, Apple Maps is enabled in regular and “satellite” (actually air imagery) modes.
You can enable a few other popular maps in the View In section of the Settings screen.
Adding More Maps
You can add additional maps - either websites or apps - to this list, if you
know the required technical details to do so.
For a website, you need to know how to construct a website address - a URL - that will
open the map at a specified location. For an app, the app needs to have a
“URL handler”, and again you’ll need to know how to construct a URL for it in
the correct format.
You may be able to find the required details by searching the web, or by asking
the people responsible for the website or app, or even by guessing.
Here’s an example: OpenRailwayMap.
To determine its URL format, I zoom in somewhere - for example, Chicago - and
tap on its “Permalink” button. My web browser’s address bar changes to show this:
https://www.openrailwaymap.org/?style=standard&lat=41.691373270757246&lon=-87.70797729492188&zoom=9
It is pretty clear that the latitude (41.6°) and longitude (-87.7°)
of Chicago are embedded in there, along with a zoom value of 9. Specifically, the URL pattern
- in the style that Topo Maps 2 wants it - is:
https://www.openrailwaymap.org/?style=standard&lat={lat}&lon={lon}&zoom={zoom}
I have simply replaced the numeric latitude, longitude and zoom values from the
captured URL with the expressions {lat}, {lon} and {zoom}.
Now to tell Topo Maps 2 about this:
- Tap to open the Settings screen, and scroll down to the “View In” section.
- Tap .
- In the form that is presented, enter “OpenRailwayMap” as the name.
- In the URL Pattern box, enter https://www.openrailwaymap.org/?style=standard&lat={lat}&lon={lon}&zoom={zoom} (without any line breaks). Yes, it’s tedious on a phone keyboard. Maybe copy-and-paste from somewhere else?
- Tap and close the settings screen.
- If you now tap , the menu will contain a new entry for OpenRailwayMap. Tap this, and the website should open showing the same area that was visible in Topo Maps 2.
Syntax of Expressions
Expressions are contained between { and }.
Expressions can contain the variables listed below, numbers, and basic arithmetic
operations. Most often the expression will just be a single variable, e.g. {lat}.
The arithmetic operations are provided to support maps that require values such as
half of one of these values, or 90° minus the value, and so on.
Available Variables.
The main variables are:
- lat and lon are the latitude and longitude respectively at the center of the screen, in signed degrees; North and East are positive, and South and West are negative.
- lat_span and lon_span are the height and width of the visible area in degrees of latitude and longitude.
- zoom is the zoom level in the form used by most web maps, i.e. 0 means the whole earth is visible and successive zoom levels zoom in by a factor of two.
Additional variables are defined in 3D mode and can be used
to link to 3D maps, i.e. Google Earth. In 3D mode the
view is defined by an eye position in space, which looks towards a target
position on the ground. lat and lon refer to the target
position.
- pitch, yaw and roll give the orientation of the eye, i.e. the direction in which it is facing, using aeronautical conventions; see Wikipedia for definitions. Zero pitch is horizontal, positive pitch is upwards and negative pitch is downwards. Zero yaw is North, positive yaw is East and negative yaw is West (beware that West could be either -90 or +270). Roll is always zero.
- distance is the distance from the eye to the target in meters.
- tgt_ele is the elevation (altitude) above sea level at the target.
- fov is the diagonal field of view angle in degrees.
Arithmetic can use the operators +, -, *, / and
mod, and can use parentheses ().
Please share any useful URL patterns that we could add to future versions of the app.
Note that View In settings are reset when the app starts in “safe mode“.
You might like to save copies of your custom URL patterns so that you can recreate them
if this happens.
Google Earth
It’s possible to link to Google Earth using this URL pattern:
https://earth.google.com/web/@{lat},{lon},{tgt_ele}a,{distance}d,{pitch+90}t,{(yaw+360) mod 360}h,{fov/2}y
- The required “tilt” parameter is 0 for down and 90 for horizontal, which is {pitch+90}.
- The required “heading” parameter is modified from our yaw value to ensure it lies between 0 and 360 using {(yaw+360) mod 360}.
- The required “y” parameter is half the field of view angle, hence {fov/2}.
- The other expressions are straightforward.
https://earth.google.com/web/ may first open the online version of
Google Earth, but should then offer to open in the app if you have it installed,
and seems to remember this choice.
This App’s URL Handler
If you want to solve the opposite problem, i.e. to open this app from another one or a
web page, then here is the information you need:
This app’s URL handler responds to URLS of the form https://topomapsapp.com/map?lat={lat}&lon={lon}&zoom={zoom}.
Or alternatively, rather than giving lat and lon parameters,
you can pass a single coords parameter that can contain any coordinate
string that the app would understand if typed in, for example MGRS coordinates.
You can optionally add a mode parameter indicating which map
mode the app should open in.
For example, here’s a link that should open the app at Central Park, NY, in Topo mode, if you
tap it on a device where the app is installed:
Alternatively, you can use the custom URL scheme com.topomaps2: with the same
parameters. Example: com.topomapsapp:lat=40.77927&lon=-73.96840&zoom=15&mode=topo.
The app doesn’t currently support opening in 3D mode. Let us know if you’d like
us to make that possible.