Reply To: Pre filled route / directions

Home Forums MapPress Support Pre filled route / directions Reply To: Pre filled route / directions



With the initialopendirections option, you can open the directions and specify the “to” location as a number (0 is the first POI, 1 is the second, etc.):

[mappress initialopendirections="0"]

If you want *both* locations filled in it’s trickier:

1) Modify the directions.php template and enter the default addresses in the input form, then use initialopendirections=”true” to open the directions when the map is displayed. This will still require the user to click the ‘get directions’ button and it’ll always use the same 2 locations.

2) Use javascript:

// Open directions between two addresses:
mapp0.openDirections("first address", "second address");

// Open directions between two pois:
mapp0.openDirections(0, 1);

// Click the 'directions' button to get the route:
jQuery('mapp-dir-get', 'mapp0_directions').click();

Note: each map has a name – “mapp0” is the default for the first map on the page. You can override the name using the “name” option in the shortcode: