2016-12-20 5 views
3

MS Access 2013で作業しています。標準化する必要のある場所/住所が数多くあります。あなたはポイントを得るデータベース内でのアドレスの標準化

  • 500 W MAIN ST
  • 500西メインセント
  • 500西メインストリート

例としては以下のようなアドレスが含まれます。

データベース内に左(7)などの文字が複数存在するすべてのレコードを取得するクエリが実行されていると考えましたが、そのロジックに明白な欠陥があります。

住所が複数回存在する可能性があるレコードのリストを作成するのに役立つ機能やクエリなどは、わずかに異なっていますか?

+0

私は、そのような思いません関数が存在する。あなたはそれを自分で処理しなければなりません。 – GurV

答えて

10

これはややこしいビジネスです。大通りのみのバリエーションに驚かれるでしょう。

私はGoogle APIを使用しています。最初のデータセットでは時間がかかることがありますが、新しい追加のみを解決する必要があります。一部

"formatted_address" : "500 S Main St, Providence, RI 02903, USA" 

と良いニュース、例えば

https://maps.googleapis.com/maps/api/geocode/json?address=500 S Main St,Providence RI 02903 

戻って、以前のクエリ

"formatted_address" : "500 S Main St, Providence, RI 02903, USA" 
として

https://maps.googleapis.com/maps/api/geocode/json?address=500 South Main Steet,Providence RI 02903 

戻り同じフォーマットアドレスであります

VBA例:...

' VBA project Reference required: 
' Microsoft XML, v3.0 

Dim httpReq As New MSXML2.ServerXMLHTTP 
httpReq.Open "GET", "https://maps.googleapis.com/maps/api/geocode/json?address=500 South Main Steet,Providence RI 02903", False 
httpReq.send 
Dim response As String 
response = httpReq.responseText 

を次のコードを実行する際

...変数response文字列は次のようなJSONデータが含まれています

{ 
    "results" : [ 
     { 
     "address_components" : [ 
      { 
       "long_name" : "500", 
       "short_name" : "500", 
       "types" : [ "street_number" ] 
      }, 
      { 
       "long_name" : "South Main Street", 
       "short_name" : "S Main St", 
       "types" : [ "route" ] 
      }, 
      { 
       "long_name" : "Fox Point", 
       "short_name" : "Fox Point", 
       "types" : [ "neighborhood", "political" ] 
      }, 
      { 
       "long_name" : "Providence", 
       "short_name" : "Providence", 
       "types" : [ "locality", "political" ] 
      }, 
      { 
       "long_name" : "Providence County", 
       "short_name" : "Providence County", 
       "types" : [ "administrative_area_level_2", "political" ] 
      }, 
      { 
       "long_name" : "Rhode Island", 
       "short_name" : "RI", 
       "types" : [ "administrative_area_level_1", "political" ] 
      }, 
      { 
       "long_name" : "United States", 
       "short_name" : "US", 
       "types" : [ "country", "political" ] 
      }, 
      { 
       "long_name" : "02903", 
       "short_name" : "02903", 
       "types" : [ "postal_code" ] 
      }, 
      { 
       "long_name" : "2915", 
       "short_name" : "2915", 
       "types" : [ "postal_code_suffix" ] 
      } 
     ], 
     "formatted_address" : "500 S Main St, Providence, RI 02903, USA", 
     "geometry" : { 
      "bounds" : { 
       "northeast" : { 
        "lat" : 41.82055829999999, 
        "lng" : -71.4028137 
       }, 
       "southwest" : { 
        "lat" : 41.8204014, 
        "lng" : -71.40319219999999 
       } 
      }, 
      "location" : { 
       "lat" : 41.8204799, 
       "lng" : -71.40300289999999 
      }, 
      "location_type" : "ROOFTOP", 
      "viewport" : { 
       "northeast" : { 
        "lat" : 41.8218288302915, 
        "lng" : -71.40165396970851 
       }, 
       "southwest" : { 
        "lat" : 41.8191308697085, 
        "lng" : -71.40435193029151 
       } 
      } 
     }, 
     "partial_match" : true, 
     "place_id" : "ChIJicPQAT9F5IkRfq2njkYqZtE", 
     "types" : [ "premise" ] 
     } 
    ], 
    "status" : "OK" 
} 
+0

簡単なHttpWebRequestで処理できますか? – McNets

+0

@mcNets絶対に、JSONを解析する必要があります。 –

+0

@mcNets言及に失敗したが、1日に2,000回のヒットがあるかもしれないが、アクセスの拡大は非常に安い。また、LAT/LNGも入手します –

関連する問題