Bug description

When using the Country Map plugin, it seems like the Michigan state is inaccurately represented.

Currently, it includes some lakes part of its shape.

Expected behaviour would be for it to not include the lake.

How to reproduce the bug

  1. Create chart
  2. Pick Country Map
  3. Select US
  4. Select any metrics / ISO
  5. Generate US Map

Screenshots/recordings

Current

(includes the great lakes)

Capture d’écran, le 2024-07-04 à 11 03 36

Expected (from Echarts)

Apache Superset Incorrect Michigan State in Country Map

https://echarts.apache.org/examples/en/editor.html?c=map-usa-projection

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

@jpmonette Hello there! I'm here to help you with any bugs, questions, or contributions you might have.

To fix the Country Map plugin in Superset to accurately represent Michigan without including the lakes as part of its shape, you need to modify the GeoJSON file for Michigan to exclude the lakes. This involves editing the coordinates in the GeoJSON file to ensure that only the land areas are included.

Here is an example of how you might modify the GeoJSON file for Michigan:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": { "name": "Michigan" },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-90.418135, 46.506993],
            [-90.229014, 46.508499],
            [-90.119674, 46.338327],
            [-90.229014, 46.338327],
            [-90.418135, 46.506993]
          ],
          // Add more coordinates here to define the land boundaries of Michigan
        ]
      }
    }
  ]
}

In this example, the coordinates should be adjusted to outline the land boundaries of Michigan, excluding the lakes. You will need to obtain the correct coordinates for Michigan's land boundaries and replace the placeholder coordinates in the example above.

Once you have the correct GeoJSON file, you can update the Country Map plugin in Superset with this new file to ensure that Michigan is represented accurately without including the lakes [1].

To continue talking to Dosu, mention @dosu.

Comment From: jpmonette

Would it be possible to achieve this by using out-of-the-box echarts GeoJSON instead of tweaking this file manually?

Comment From: dosubot[bot]

Yes, you can achieve this by using out-of-the-box ECharts GeoJSON data instead of manually tweaking the file. Superset allows you to specify or override the default GeoJSON data used by ECharts within its configuration.

Here is an example of how you can specify custom GeoJSON data in an ECharts configuration within Superset:

// Example ECharts configuration with custom GeoJSON data
const option = {
    series: [
        {
            type: 'map',
            map: 'USA', // Name of the custom map
            geoJSON: usaGeoJSONData, // Your custom GeoJSON data for the USA
            // Other series options
        }
    ],
    // Other chart options
};

// Register the custom map with ECharts
echarts.registerMap('USA', usaGeoJSONData);

// Set the option to the ECharts instance
echartsInstance.setOption(option);

In this example, usaGeoJSONData should be replaced with the actual GeoJSON data for the USA that correctly represents Michigan without including the lakes. You can obtain this GeoJSON data from the ECharts examples or other reliable sources.

By registering the custom map with ECharts and setting the appropriate options, you can ensure that the Country Map plugin in Superset uses the correct GeoJSON data for rendering the map [1].

To continue talking to Dosu, mention @dosu.

Comment From: rusackas

While ECharts provides a means to render GeoJSON, they do not provide a source of GeoJSON data. NaturalEarth is not perfect, but it's license compatible and fairly adaptable via the Jupyter Notebook in the codebase.

Comment From: rusackas

Would love to see the linked PR merged... let me know if you (or anyone reading this!) can make the update(s) in the Jupyter notebook.

Comment From: rusackas

Sorry this slipped under the radar (agian)... but would love to see the jupyter notebook updated so we can merge the results of it running. Here's a blog post on the topic if it helps: https://preset.io/blog/how-and-when-and-why-to-update-apache-supersets-country-maps/