{"id":19122607,"url":"https://github.com/vulcanjs/vulcan-places","last_synced_at":"2025-05-05T17:59:16.989Z","repository":{"id":148526098,"uuid":"90589504","full_name":"VulcanJS/vulcan-places","owner":"VulcanJS","description":"Google Maps Places integration for Vulcan","archived":false,"fork":false,"pushed_at":"2018-06-16T03:13:22.000Z","size":8,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T10:28:35.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VulcanJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-08T05:26:23.000Z","updated_at":"2023-04-10T05:10:47.000Z","dependencies_parsed_at":"2023-05-20T10:00:44.589Z","dependency_job_id":null,"html_url":"https://github.com/VulcanJS/vulcan-places","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/VulcanJS%2Fvulcan-places","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VulcanJS%2Fvulcan-places/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VulcanJS%2Fvulcan-places/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VulcanJS%2Fvulcan-places/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VulcanJS","download_url":"https://codeload.github.com/VulcanJS/vulcan-places/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252548766,"owners_count":21766242,"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-09T05:22:11.478Z","updated_at":"2025-05-05T17:59:16.969Z","avatar_url":"https://github.com/VulcanJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vulcan Places\n\n### Install\n\n```\nmeteor add vulcan:places\n```\n\n### Usage\n\nThis package enables two distinct features, which can be used separately or together: \n\n1. A `PlaceControl` autocomplete form component that lets users fill in a place via the Google Maps Places API.\n2. A `Places` collection that can optionally be used to store places as individual documents.\n\nBoth require setting your Google Maps API key in your `settings.json` file's `public` section: \n\n```\n\"googlemaps\": {\n  \"apiKey\": \"123foo\"\n}\n```\nAnd install npm packages :\n```\nnpm install --save @google/maps react-places-autocomplete\n```\n\n### Place Form Control\n\nUses [https://github.com/kenny-hibino/react-places-autocomplete](https://github.com/kenny-hibino/react-places-autocomplete).\n\nTo use:\n\n1. Import `PlaceControl` from 'meteor/vulcan:places'\n2. Create a `placeName` custom field on one of your collections\n3. Set this field's `control` property to `PlaceControl`. \n4. Also create a `placeId` field on the same collection.\n5. Add `placeName` and `placeId` to the appropriate fragments. \n\n### Places Collection\n\nUses [https://github.com/googlemaps/google-maps-services-js](https://github.com/googlemaps/google-maps-services-js).\n\nThe `Places` collection makes it easy to check for a `placeId` field on a newly inserted or edited document, and if present insert a new place document.\n\nThere are two distinct ways to use this collection:\n\n1. Associate a place with one or more documents from another collection, such as adding a location to individual photos.\n2. Build a Yelp-like directory of places by using the `Places` collection as a base and adding your own custom fields to it. \n\n#### checkAndAddPlace\n\nThe package exports a `checkAndAddPlace` function that takes a `placeId`, checks the `Places` collection for any existing document with that id, and if none is found queries the Google Places API for the place details before inserting it in the database:\n\n```js\nimport { addCallback } from 'meteor/vulcan:core';\nimport { checkAndAddPlace } from 'meteor/vulcan:places';\n\nfunction postsNewCheckForNewPlace (document, user) {\n  if (document.placeId) checkAndAddPlace(document.placeId);\n}\naddCallback('posts.new.async', postsNewCheckForNewPlace);\n\nfunction postsEditCheckForNewPlace (document) {\n  if (document.placeId) checkAndAddPlace(document.placeId);\n}\naddCallback('posts.edit.async', postsEditCheckForNewPlace);\n```\n\n#### Resolvers\n\nThe package also creates resolvers for the `Places` collection. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvulcanjs%2Fvulcan-places","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvulcanjs%2Fvulcan-places","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvulcanjs%2Fvulcan-places/lists"}