{"id":18887698,"url":"https://github.com/bramus/google-maps-polygon-moveto","last_synced_at":"2025-04-14T22:34:10.767Z","repository":{"id":6973966,"uuid":"8227118","full_name":"bramus/google-maps-polygon-moveto","owner":"bramus","description":"Programmatically move a google.maps.Polygon to a new google.maps.LatLng using Google Maps V3","archived":false,"fork":false,"pushed_at":"2016-06-06T08:15:09.000Z","size":5,"stargazers_count":10,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T10:54:21.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bramus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-15T22:02:35.000Z","updated_at":"2025-01-16T07:22:42.000Z","dependencies_parsed_at":"2022-07-21T12:18:21.128Z","dependency_job_id":null,"html_url":"https://github.com/bramus/google-maps-polygon-moveto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fgoogle-maps-polygon-moveto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fgoogle-maps-polygon-moveto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fgoogle-maps-polygon-moveto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fgoogle-maps-polygon-moveto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramus","download_url":"https://codeload.github.com/bramus/google-maps-polygon-moveto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248973399,"owners_count":21191960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T07:39:01.713Z","updated_at":"2025-04-14T22:34:05.751Z","avatar_url":"https://github.com/bramus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google.maps.Polygon.moveTo()\r\n\r\nProgrammatically move a `google.maps.Polygon` to a new `google.maps.LatLng` using Google Maps V3\r\nBuilt by Bramus! - [http://www.bram.us/](http://www.bram.us/)\r\n\r\n\r\n## About\r\n\r\nSince Google Maps v3.11 it's possible to move around a `google.maps.Polygon` by using the mouse _(if the `draggable` property is set to `true`)_. `google.maps.Polygon.moveTo()` is a Google Maps extension augmenting that functionality by allowing one to programmatically move a `google.maps.Polygon` on the map without any user/mouse interaction. The script works with both geodesic _(polygons that follow the curvature of the earth)_ and non-geodesic _(straight)_ polygons.\r\n\r\n\r\n## Installation\r\n\r\n* Include the scripts `js/google.maps.Polygon.getBounds.js` and `js/google.maps.Polygon.moveTo.js` in your HTML page\r\n* Include the Google Maps script with the [Google Maps Geometry Library](https://developers.google.com/maps/documentation/javascript/geometry) included. You can do this by referencing `http://maps.googleapis.com/maps/api/js?v=3.exp\u0026sensor=false\u0026libraries=geometry`\r\n\r\n\r\n## How to use\r\n\r\nSee the example. Basically just call `myPolygon.moveTo(new google.maps.LatLng(lat, lng))` to move the Polygon to the new Latitude/Longitude.\r\n\r\n\r\n## Notes / Bugs\r\n\r\n* Alas it's not perfect: Rounding errors occur _(You can see this best when moving a polygon with `geodesic` enabled to one location and then moving it back: you'll see that the shape seems to have tilted a bit)_\r\n* When using non-geodesic polygons it's recommened to wrap `google.maps.Polygon#moveTo()` in a `setTimeout()` with a timing of `200` in order to have `google.maps.Map#getProjection()` available _(it's only available after the map has started rendering)_\r\n\r\n\r\n\r\n## License\r\n\r\n`google.maps.Polygon.moveTo()` is released under the MIT public license. See the enclosed `LICENSE` for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramus%2Fgoogle-maps-polygon-moveto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramus%2Fgoogle-maps-polygon-moveto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramus%2Fgoogle-maps-polygon-moveto/lists"}