Pre filled route / directions

Home Forums MapPress Support Pre filled route / directions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #13201

    Is it at all possible to have a route prefilled on a page? I have been trying to work this out.

    I am making a taxi website and would like to have the map come up with two POI and the route line drawn between them.

    Thanks for any help on this.



    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:

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.