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

Just a suggestion: for GeoJson's linear rings in polygons, remove the last vertex #17

Open
okrische opened this issue Sep 30, 2013 · 0 comments · May be fixed by #22
Open

Just a suggestion: for GeoJson's linear rings in polygons, remove the last vertex #17

okrische opened this issue Sep 30, 2013 · 0 comments · May be fixed by #22

Comments

@okrische
Copy link

Hello,

thanks for the script.

While debugging my code, i came to see this in the spec:

"Paths are closed automatically; do not repeat the first vertex of the path as the last vertex."

See:

https://developers.google.com/maps/documentation/javascript/reference#PolygonOptions

The linear rings in polygons in GeoJson have this extra vertex. So it could be removed (go up to length-1), when copying/transforming, like your script does.

                        for (var k = 0; k < geojsonGeometry.coordinates[i][j].length; k++){
                            // the ring: array of coordinates, where first/last coordinate/vertex/point match
                            var ll = new google.maps.LatLng(geojsonGeometry.coordinates[i][j][k][1], geojsonGeometry.coordinates[i][j][k][0]);
                            bounds.extend(ll);
                            path.push(ll);
                        }

Thats all :)

@justincy justincy linked a pull request Jan 23, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant