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

Maps with custom GeoJson data renders incorrect polygon #3117

Closed
ghost opened this issue Nov 20, 2020 · 6 comments
Closed

Maps with custom GeoJson data renders incorrect polygon #3117

ghost opened this issue Nov 20, 2020 · 6 comments

Comments

@ghost
Copy link

ghost commented Nov 20, 2020

I'm following the Amcharts Map tutorial to create a visualisation using other open sourced geodata.

I'm trying to display a map of Virginia counties and I followed the tutorial step by step and this is what I get:
image

Whereas it should look like this:
image

I have tried reversing the co-ordinates but it lands to same polygon.

Here is a snippet:

var chart = am4core.create("mapDiv", am4maps.MapChart);
chart.geodata = mapJson;

// Set projection
chart.projection = new am4maps.projections.AlbersUsa();

// Create map polygon series
var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;

// Configure series
var polygonTemplate = polygonSeries.mapPolygons.template;
polygonTemplate.tooltipText = "{geocoding.name}";
polygonTemplate.fill = am4core.color("#74B266");

And the mapJson looks like:
var mapJson = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id": 12,
"properties": {
"place_id": 235602888,
"display_name": "Балтасинский район, Татарстан, Приволжский федеральный округ, Россия"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-77.655169, 38.942656],
[-77.657581, 38.943231],
[-77.658739, 38.943508],
...
]
]
}
}
]
}

Is there anything wrong with this code or json?

@martynasma
Copy link
Collaborator

@ghost
Copy link
Author

ghost commented Nov 20, 2020

Tried this but still getting the same issue.

county_map

I am using this GeoJson file

modifiedVaCounties.zip

@mtmibjas
Copy link

You have to rewind your JSON. you can do here https://observablehq.com/

@martynasma
Copy link
Collaborator

Can you check you are running the latest version? The setting was added in the version 4.10.11.

@ghost
Copy link
Author

ghost commented Nov 23, 2020

I was running on 4.9 version.
But rewinding the json from the link that @mtmibjas shared worked and map rendered properly.

Thanks for your help.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants