Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Michigan State in Country Map #29485

Open
3 tasks done
jpmonette opened this issue Jul 4, 2024 · 4 comments
Open
3 tasks done

Incorrect Michigan State in Country Map #29485

jpmonette opened this issue Jul 4, 2024 · 4 comments
Labels
viz:charts:map Related to Map charts

Comments

@jpmonette
Copy link

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)

image

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

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • 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.
@dosubot dosubot bot added the viz:charts:map Related to Map charts label Jul 4, 2024
Copy link

dosubot bot commented Jul 4, 2024

@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
        ]
      }
    }
  ]
}
Loading

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.

@jpmonette
Copy link
Author

jpmonette commented Jul 4, 2024

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

Copy link

dosubot bot commented Jul 4, 2024

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.

@rusackas
Copy link
Member

rusackas commented Jul 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
viz:charts:map Related to Map charts
Projects
None yet
Development

No branches or pull requests

2 participants