From 744d47ed32c8c37129ff9701c11bbf0715497aaa Mon Sep 17 00:00:00 2001 From: Jake Morrison Date: Mon, 11 Oct 2021 23:48:00 -0500 Subject: [PATCH] refreshed t --- README.md | 35 +++++++++++-------- docs/BingMapsAPI.md | 13 +++++-- docs/GoogleMapsAPI.md | 15 ++++++-- .../Infrastructure/pwshPlaces-Infra.Tests.ps1 | 8 ++--- 4 files changed, 46 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 2acdfeb..8845239 100644 --- a/README.md +++ b/README.md @@ -20,22 +20,22 @@ pwshPlaces is a PowerShell module that can help you discover places and search f pwshPlaces enables you to leverage the Google Maps and/or Bing Maps API(s) to perform a variety of maps related tasks using PowerShell: -* Search for places, entities, addresses, and other points of interest -* Discover locations near your or near a specified place -* Easily perform Geocoding and reverse Geocoding actions -* Get detailed place information including opening hours, website information, and contact information +- Search for places, entities, addresses, and other points of interest +- Discover locations near your or near a specified place +- Easily perform Geocoding and reverse Geocoding actions +- Get detailed place information including opening hours, website information, and contact information [pwshPlaces](docs/pwshPlaces.md) provides the following functions: -* [Find-BingPlace](docs/Find-BingPlace.md) -* [Find-BingTimeZone](docs/Find-BingTimeZone.md) -* [Find-GMapPlace](docs/Find-GMapPlace.md) -* [Get-GMapPlaceDetail](docs/Get-GMapPlaceDetail.md) -* [Invoke-BingGeoCode](docs/Invoke-BingGeoCode.md) -* [Invoke-GMapGeoCode](docs/Invoke-GMapGeoCode.md) -* [Search-BingNearbyPlace](docs/Search-BingNearbyPlace.md) -* [Search-GMapNearbyPlace](docs/Search-GMapNearbyPlace.md) -* [Search-GMapText](docs/Search-GMapText.md) +- [Find-BingPlace](docs/Find-BingPlace.md) +- [Find-BingTimeZone](docs/Find-BingTimeZone.md) +- [Find-GMapPlace](docs/Find-GMapPlace.md) +- [Get-GMapPlaceDetail](docs/Get-GMapPlaceDetail.md) +- [Invoke-BingGeoCode](docs/Invoke-BingGeoCode.md) +- [Invoke-GMapGeoCode](docs/Invoke-GMapGeoCode.md) +- [Search-BingNearbyPlace](docs/Search-BingNearbyPlace.md) +- [Search-GMapNearbyPlace](docs/Search-GMapNearbyPlace.md) +- [Search-GMapText](docs/Search-GMapText.md) ## Why @@ -51,8 +51,8 @@ To use pwshPlaces you will require a Google Maps or Bing Maps API key. To use al Both of these Map API keys are *easy to create* and have *no cost* pricing tiers which should meet your needs. I have provided detailed guides on how to get your API keys: -* [How to get a Google Maps API Key](docs/GoogleMapsAPI.md#how-to-get-a-google-maps-api-key) -* [How to get a Bing Maps API Key](docs/BingMapsAPI.md#how-to-get-a-bing-maps-api-key) +- [How to get a Google Maps API Key](docs/GoogleMapsAPI.md#how-to-get-a-google-maps-api-key) +- [How to get a Bing Maps API Key](docs/BingMapsAPI.md#how-to-get-a-bing-maps-api-key) ### Install pwshPlaces @@ -123,6 +123,11 @@ Find-BingTimeZone -PointLatitude 29.70 -PointLongitude -98.11 -BingMapsAPIKey $b ## Notes +Read more about: + +- [Google Maps API](docs/GoogleMapsAPI.md) +- [Bing Maps API](docs/BingMapsAPI.md) + This PowerShell project was created with [Catesta](https://github.com/techthoughts2/Catesta). ## Changelog diff --git a/docs/BingMapsAPI.md b/docs/BingMapsAPI.md index 7d280c6..2e98a6b 100644 --- a/docs/BingMapsAPI.md +++ b/docs/BingMapsAPI.md @@ -69,9 +69,16 @@ Import-Module pwshPlaces $scrapePath = $env:Temp -$locale = Invoke-BingGeoCode -Query 'New Braunfels, TX' - -$areaRestaurants = Search-BingNearbyPlace -Type Restaurants -PointLatitude $locale.Latitude -PointLongitude $locale.Longitude -MaxResults 20 +$locale = Invoke-BingGeoCode -Query 'New Braunfels, TX' -BingMapsAPIKey $env:BingAPIKey + +$searchBingNearbyPlaceSplat = @{ + Type = 'Restaurants' + PointLatitude = $locale.Latitude + PointLongitude = $locale.Longitude + MaxResults = 20 + BingMapsAPIKey = $env:BingAPIKey +} +$areaRestaurants = Search-BingNearbyPlace @searchBingNearbyPlaceSplat ConvertTo-Clixml -InputObject $areaRestaurants -Depth 100 | Out-File "$scrapePath\localRestaurants.xml" #-------------------------------------------------------------- diff --git a/docs/GoogleMapsAPI.md b/docs/GoogleMapsAPI.md index bd1562e..b7f167c 100644 --- a/docs/GoogleMapsAPI.md +++ b/docs/GoogleMapsAPI.md @@ -120,9 +120,18 @@ Import-Module pwshPlaces $scrapePath = $env:Temp -$locale = Invoke-GMapGeoCode -Address 'New Braunfels' - -$areaRestaurants = Search-GMapNearbyPlace -Latitude $locale.Latitude -Longitude $locale.Longitude -Radius 10000 -RankByProminence -Type restaurant -AllSearchResults +$locale = Invoke-GMapGeoCode -Address 'New Braunfels' -GoogleAPIKey $env:GoogleAPIKey + +$searchGMapNearbyPlaceSplat = @{ + Latitude = $locale.Latitude + Longitude = $locale.Longitude + Radius = 10000 + RankByProminence = $true + Type = 'restaurant' + AllSearchResults = $true + GoogleAPIKey = $env:GoogleAPIKey +} +$areaRestaurants = Search-GMapNearbyPlace @searchGMapNearbyPlaceSplat ConvertTo-Clixml -InputObject $areaRestaurants -Depth 100 | Out-File "$scrapePath\localRestaurants.xml" #-------------------------------------------------------------- diff --git a/src/Tests/Infrastructure/pwshPlaces-Infra.Tests.ps1 b/src/Tests/Infrastructure/pwshPlaces-Infra.Tests.ps1 index bc9f04e..261abce 100644 --- a/src/Tests/Infrastructure/pwshPlaces-Infra.Tests.ps1 +++ b/src/Tests/Infrastructure/pwshPlaces-Infra.Tests.ps1 @@ -11,10 +11,10 @@ Import-Module $PathToManifest -Force #------------------------------------------------------------------------- Describe 'Infrastructure Tests' -Tag Infrastructure { # for local dev testing only - BeforeEach { - $env:GoogleAPIKey = 'AIzaSyCyXypZobAjrOnRKoPKa6aZqcRWPw7od-U' - $env:BingAPIKey = 'AlX3WrsMGXpT3HauFYqm7AqAU3s1xWWb_Fp55Xpf99m0gHWxHouzZssxngC9NUI9' - } + # BeforeEach { + # $env:GoogleAPIKey = '' + # $env:BingAPIKey = '' + # } Context 'Google Maps Function Tests' { Context 'Find-GMapPlace' {