×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

well, after doing a round of demos on atlas and having to work with the virtual earth map stuff (argh), i decided that geocoding sucked and i’m surprised it isn’t a base offering in more apis.  i guess i don’t understand why, when maps, etc. are being handed out like candy, but a simple method/api/whatever to provide the address and get the lat/long back isn’t — after all, the maps are doing it anyway.

at any rate, i found a few providers, the free one of which seems to be running off of a sixth graders pda…and can only handle about 1/2 simultaneous request.  i started using it though with my demos for being short on time (easy interface to use).  i then rethought that idea and decided a pluggable model would be better.

alas, GeoCodeProvider is born.  in crude form right now, it seemed to work on my known tests ;-).  i’ve created a space for it on gotdotnet to give my man korby some props.

i’ve also included a YahooGeoCodeProvider as an initial provider.  the zip is an asp.net 2.0 application using atlas to demonstrate mapping the northwind (US) customers to a virtual earth map.

check it out: download GeoCodeProvider sample.  i’ll soon be adding a mappoint/msn provider when i get around to it.

basically, all you need to do is add the the binaries as references:

Geocoderef

then in your web.config, add the config section:

    1 <sectionGroup name="system.web">

    2       <section name="geoCodeService" type="SmilingGoat.Providers.GeoCodeProviderConfigSection, GeoCodeProvider"

allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>

    3     </sectionGroup>

then in web.config, set the provider:

    1   <system.web>

    2     <geoCodeService defaultProvider="YahooGeoCodeProvider">

    3       <providers>

    4         <add name="YahooGeoCodeProvider" type="SmilingGoat.Providers.YahooGeoCodeProvider"

providerUrl="http://api.local.yahoo.com/MapsService/V1/geocode?appid={0}&amp;street={1}&amp;city={2}&amp;state={3}&amp;zip={4}"

applicationId="YahooDemo"/>

    5       </providers>

    6     </geoCodeService>

once you do that, you are good to go, simply pass the provider service api a street address, city, state, zip (sorry us only) and get back coordinates.  the sample site maps them on an atlas ve map:

Geocodemap



DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.