Automatically draw an area on map load


The plugin offers the ability to automatically display areas on the map as soon as it loads, a feature we refer to as “Pre-Drawn Areas”. This functionality allows you to add predefined areas and initiate a search request immediately upon map load. However, providing a Pre-Drawn Area is optional, as users can still create their own areas using the drawing tools.

To set up a Pre-Drawn Area, follow these steps:

Step 1: Enable the tool “Draw a Map Search”

  1. Edit your map and open the “Draw a Search Settings” widget.
  2. Navigate to the “Draw a Map Search” menu.
  3. Set the “Draw a map search option” field to “Yes”.

Step 2: Add and Configure Areas

  1. Scroll to the “Pre-Drawn Areas” section. Click on the group field “Area 1” or “Add new area” for additional areas.
  2. In the “Area name” field, enter the area’s name or title.
  3. Enter the area coordinates in the “Area/Polygon Paths” field using the format [Lat,Lng] or [Lng,Lat]. Example: [45.5215,-1.5245],[41.2587,-1.2479],[40.1649,-1.9879]
  4. Select the coordinates format in the field “LatLngs order”. Refer to the instructions in “Step 4” below to ensure the proper placement and display of your areas!
  5. In the “Visibility” field, choose whether the area should be visible by default on the map by selecting either “Show” or “Hide”.

Step 3: Adding More Areas

Click “Add new area” and repeat the steps above for additional areas, or save your map settings if you’ve finished adding areas.

Step 4: Verify Areas Placement

To ensure that the added areas appear correctly on the frontend map, it is important to confirm that the coordinates are in the “Latitude” followed by “Longitude” format. If you have copied coordinates from a service, they are likely in reverse order (“Longitude, Latitude”), which may cause the polygons to display incorrectly or not appear at all.

To resolve this issue, follow these steps:

    1. After adding your areas, save the map settings.
    2. Revisit the map settings and review each area by opening the area widget to confirm their placement on the map.
    3. If an area is misplaced, it may have reversed coordinates. In this case, click the “Reverse coordinates” button at the top of the map. This tool quickly reverses the order of all area vertices.
    4. Once the area appears correctly on the map, click “Update/Display polygon coordinates” to save the changes.
    5. Save your map settings after verifying the placement of all areas.

By taking these steps, you ensure your areas are displayed accurately on the frontend map.


In the same context