Map Center Point Calculation Rule

  • Last update:February 07, 2025
  • Overview

    When writing the map JSON, someone may not understand the calculation logic of the map center point, resulting in the inability to locate the center of the map when drilling down to a clicked area. For example, the American region is not displayed at the center of the map after being clicked. The following figure shows the expected effect by the normal calculation logic.

    1615791609966488.gif

    Introduction to Map Center Point Calculation Rule

    Take the maximum and minimum values of latitude and longitude, and calculate the average to get the position of the center point.

    North latitude is greater than 0; South latitude is less than 0;

    East longitude is greater than 0; West longitude is less than 0;

    However, if the longitude of the region crosses the east and west, the calculated center point may not be what is needed. In this case, the longitude needs to be processed into the same sign.

    Example:

    From the Aleutian Islands to Greenland, the longitude is approximately 170 to -20, (170-20)/2=75.

    This calculation will get the center of the Americas on the Eurasian continent, which is not the desired result.

    Therefore, the longitude of the Aleutian Islands is recorded as 170-360=-190, (-190-20)/2=-105.

    The result longitude -105 is on the American continent.

    iconNote:

    If you use our map editor to edit, the edited result has already been processed.

    In addition, for the American region is relatively large, when the corresponding zoom level at the drilling level is set to automatic, the entire region is displayed by default, and the map will not automatically zoom to the center of the American region. You are recommended to set it to 2 here.


    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy