måndag 23 mars 2015

DNAGEN och Geo location

Ibland lyckas DNAGEN inte tolka de orter man matat in exempel



dvs. får fel på orter
Badelunda, Västerås, Västmanland, Sweden
Norrbärke, Smedjebacken,Dalarnas län, Sweden

Google maps

Min förståelse är att DNAGEN använder och att det är Google som har problem att tolka den ort man skriver in. Vill man testa direkt hur ett orsnamn fungerar kan man testa det med URL:en

https://maps.googleapis.com/maps/api/geocode/json?address=

där address är det som skall testas dvs

Test med Badelunda, Västerås, Västmanland, Sweden 


får ett resultat enligt nedan med flera address components exempel
               "long_name" : "Badelundavägen",
               "long_name" : "Badelundavägen",
               "long_name" : "Badelundavägen",
               "long_name" : "Hökåsen-Badelunda",
               "long_name" : "Badelunda Vedby",
               "long_name" : "Badelunda Berga",
               "long_name" : "Badelunda Ridge",

Hela resultatet
{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Badelundavägen",
               "short_name" : "Badelundavägen",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Hökåsen-Badelunda",
               "short_name" : "Hökåsen-Badelunda",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72596",
               "short_name" : "72596",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelundavägen, 725 96 Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.6475597,
                  "lng" : 16.6256761
               },
               "southwest" : {
                  "lat" : 59.64165999999999,
                  "lng" : 16.6091189
               }
            },
            "location" : {
               "lat" : 59.6447861,
               "lng" : 16.6177456
            },
            "location_type" : "GEOMETRIC_CENTER",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.6475597,
                  "lng" : 16.6256761
               },
               "southwest" : {
                  "lat" : 59.64165999999999,
                  "lng" : 16.6091189
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJwb2xlhhnXkYRjubhZG3Uuoo",
         "types" : [ "route" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Badelundavägen",
               "short_name" : "Badelundavägen",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Hökåsen-Badelunda",
               "short_name" : "Hökåsen-Badelunda",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72231",
               "short_name" : "72231",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelundavägen, 722 31 Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.6645941,
                  "lng" : 16.5980868
               },
               "southwest" : {
                  "lat" : 59.663857,
                  "lng" : 16.589375
               }
            },
            "location" : {
               "lat" : 59.664137,
               "lng" : 16.5935513
            },
            "location_type" : "GEOMETRIC_CENTER",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.66557453029152,
                  "lng" : 16.5980868
               },
               "southwest" : {
                  "lat" : 59.6628765697085,
                  "lng" : 16.589375
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJCapDzPBmXkYR80k4PWRa4AA",
         "types" : [ "route" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Badelundavägen",
               "short_name" : "Badelundavägen",
               "types" : [ "bus_station", "transit_station", "establishment" ]
            },
            {
               "long_name" : "Hökåsen-Badelunda",
               "short_name" : "Hökåsen-Badelunda",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72231",
               "short_name" : "72231",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelundavägen, 722 31 Västerås, Sverige",
         "geometry" : {
            "location" : {
               "lat" : 59.6635373,
               "lng" : 16.5916774
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.6648862802915,
                  "lng" : 16.5930263802915
               },
               "southwest" : {
                  "lat" : 59.6621883197085,
                  "lng" : 16.5903284197085
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJDXFP3_BmXkYRrIv-juRj5i8",
         "types" : [ "bus_station", "transit_station", "establishment" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Badelunda Tibble",
               "short_name" : "Badelunda Tibble",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Hökåsen-Badelunda",
               "short_name" : "Hökåsen-Badelunda",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72596",
               "short_name" : "72596",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelunda Tibble, 725 96 Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.63048939999999,
                  "lng" : 16.6401352
               },
               "southwest" : {
                  "lat" : 59.623327,
                  "lng" : 16.6338479
               }
            },
            "location" : {
               "lat" : 59.6275837,
               "lng" : 16.6369112
            },
            "location_type" : "GEOMETRIC_CENTER",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.63048939999999,
                  "lng" : 16.6401352
               },
               "southwest" : {
                  "lat" : 59.623327,
                  "lng" : 16.6338479
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJl_ndDUhnXkYRVMhgaWHTgb8",
         "types" : [ "route" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Hökåsen-Badelunda",
               "short_name" : "Hökåsen-Badelunda",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Hökåsen-Badelunda, Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.676659,
                  "lng" : 16.6539362
               },
               "southwest" : {
                  "lat" : 59.61410790000001,
                  "lng" : 16.5684681
               }
            },
            "location" : {
               "lat" : 59.6475836,
               "lng" : 16.6091455
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.676659,
                  "lng" : 16.6539362
               },
               "southwest" : {
                  "lat" : 59.61410790000001,
                  "lng" : 16.5684681
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJAxFpbh9nXkYRjjhmq_80dQY",
         "types" : [ "sublocality_level_1", "sublocality", "political" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Badelunda Vedby",
               "short_name" : "Badelunda Vedby",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Västerås NO",
               "short_name" : "Västerås NO",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72596",
               "short_name" : "72596",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelunda Vedby, 725 96 Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.63933530000001,
                  "lng" : 16.7225677
               },
               "southwest" : {
                  "lat" : 59.63719030000001,
                  "lng" : 16.6989398
               }
            },
            "location" : {
               "lat" : 59.6392614,
               "lng" : 16.7107204
            },
            "location_type" : "GEOMETRIC_CENTER",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.63961178029152,
                  "lng" : 16.7225677
               },
               "southwest" : {
                  "lat" : 59.6369138197085,
                  "lng" : 16.6989398
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJP1SSIpZdXkYRg6etVRblcig",
         "types" : [ "route" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Badelunda Berga",
               "short_name" : "Badelunda Berga",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Västerås NO",
               "short_name" : "Västerås NO",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72596",
               "short_name" : "72596",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelunda Berga, 725 96 Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.6394041,
                  "lng" : 16.7056652
               },
               "southwest" : {
                  "lat" : 59.6328768,
                  "lng" : 16.6957367
               }
            },
            "location" : {
               "lat" : 59.63718850000001,
               "lng" : 16.6987903
            },
            "location_type" : "GEOMETRIC_CENTER",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.6394041,
                  "lng" : 16.7056652
               },
               "southwest" : {
                  "lat" : 59.6328768,
                  "lng" : 16.6957367
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJceWQ_Y1dXkYRI2rdY5P0r3g",
         "types" : [ "route" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Badelunda Ridge",
               "short_name" : "Badelunda Ridge",
               "types" : [ "natural_feature", "establishment" ]
            },
            {
               "long_name" : "Skiljebo-Viksäng",
               "short_name" : "Skiljebo-Viksäng",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanland County",
               "short_name" : "Västmanland County",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72135",
               "short_name" : "72135",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelunda Ridge, 721 35 Västerås, Sverige",
         "geometry" : {
            "location" : {
               "lat" : 59.6166667,
               "lng" : 16.6166667
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.61801568029151,
                  "lng" : 16.61801568029151
               },
               "southwest" : {
                  "lat" : 59.61531771970849,
                  "lng" : 16.6153177197085
               }
            }
         },
         "partial_match" : true,
         "place_id" : "ChIJs9w-g8tgXkYRZWt5SZRtWp4",
         "types" : [ "natural_feature", "establishment" ]
      }
   ],
   "status" : "OK"
}

Lösning

Ändra Badelunda, Västerås, Västmanland, Sweden
Till Badelunda-Tibble, Västerås, Västmanland, Sweden

==> att en resultat komponent returneras

Test med Badelunda-Tibble, Västerås, Västmanland, Sweden
==> en adresskomponent
{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Badelunda Tibble",
               "short_name" : "Badelunda Tibble",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Hökåsen-Badelunda",
               "short_name" : "Hökåsen-Badelunda",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Västerås",
               "short_name" : "Västerås",
               "types" : [ "postal_town" ]
            },
            {
               "long_name" : "Västmanlands län",
               "short_name" : "Västmanlands län",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Sverige",
               "short_name" : "SE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "72596",
               "short_name" : "72596",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Badelunda Tibble, 725 96 Västerås, Sverige",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 59.63048939999999,
                  "lng" : 16.6401352
               },
               "southwest" : {
                  "lat" : 59.623327,
                  "lng" : 16.6338479
               }
            },
            "location" : {
               "lat" : 59.6275837,
               "lng" : 16.6369112
            },
            "location_type" : "GEOMETRIC_CENTER",
            "viewport" : {
               "northeast" : {
                  "lat" : 59.63048939999999,
                  "lng" : 16.6401352
               },
               "southwest" : {
                  "lat" : 59.623327,
                  "lng" : 16.6338479
               }
            }
         },
         "place_id" : "ChIJl_ndDUhnXkYRVMhgaWHTgb8",
         "types" : [ "route" ]
      }
   ],
   "status" : "OK"
}


Test med Norrbärke, Smedjebacken,Dalarnas län, Sweden

Tolkar Google map api och ger tillbaka 2 adresskomponenter

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Norrbärke kyrka",
               "short_name" : "Norrbärke kyrka",
               "types" : [ "point_of_interest", "establishment" ]
            },
..........
..........
      },
      {
         "address_components" : [
            {
               "long_name" : "Norrbärke Sjukhem",
               "short_name" : "Norrbärke Sjukhem",
               "types" : [ "point_of_interest", "establishment" ]
            },
..........
..........
} ], "status" : "OK" }

Inga kommentarer:

Skicka en kommentar