This might be especially good since bing accepts key-value pairs for different address components, instead of just a big mashed-together string like all the others. We might get more accurate results...

Documentation is here:
http://msdn.microsoft.com/en-us/library/ff701714.aspx

CommentFileSizeAuthor
#4 interdiff.txt743 bytesattiks
#4 i1542842-4.patch5.86 KBattiks
#2 i1542842-2.patch5.81 KBattiks

Comments

phayes’s picture

Title: Bing Geocoder » Bing Geocoding Handler
attiks’s picture

Status: Active » Needs review
StatusFileSize
new5.81 KB

Bing support, keep in mind you need an API key

Supports free text and structured searches.

jtherkel’s picture

I quickly applied this patch in a dev environment and added a Bing API key at admin/config/content/geocoder. The lines below produced this error.

Fatal error: Cannot use object of type stdClass as array in sites/all/modules/contrib/geocoder/plugins/geocoder_handler/bing.inc on line 107

I commented out the three lines below, and it appeared to work.

// If there are any other geometries, these are auxiliary geometries that represent "alternatives"
if (count($geometries)) {
  $geometry->data['geocoder_alternatives'] = $geometries;
}

I see these lines present in plugins/geocoder_handler/google.inc but none of the other plugins. Should we remove them from the Bing plugin?

attiks’s picture

StatusFileSize
new5.86 KB
new743 bytes

Fixed in latest patch, I also added a check for an empty response

jtherkel’s picture

Status: Needs review » Reviewed & tested by the community

The patch from #4 worked for me with Geocoder 7.x-1.2. Thanks!

retiredpro’s picture

tried patch on 7.x-1.2 and it didnt work for me. I signed up and entered my bing api in the configuration, changed my geofield to use bing, kept Multi-value input handling to Match Multiples(default), and entered an address into my node and saved. no error message but no geofield data populated.

I tried the following code to test :
// Geocode an address
$address = '4925 Gair Ave, Terrace, BC';
$point = geocoder('bing',$address);
$geoJSON = $point->out('json');
dpm($geoJSON);

And it does generate a coordinates for me so it looks like the api is working
{"type":"Point","coordinates":[-128.6077576,54.5362015]}

Any ideas on why it would not be saving? Thanks

retiredpro’s picture

Status: Reviewed & tested by the community » Needs review
attiks’s picture

Status: Needs review » Reviewed & tested by the community

Try dpm($point); and you'll see all data. The $point->out just returns the coordinates

Brandonian’s picture

Status: Reviewed & tested by the community » Fixed

#4 committed to 7.x-1.x. Thanks for the patch, @attiks!

http://drupalcode.org/project/geocoder.git/commit/aba5d28

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

duntuk’s picture

What's the deal with Bing support? it doesn't work on node creation (geocode via Bing), but does work with views geofiled promixty.

I think Bing should be priority right now, as it allows 50,000 transactions per day.

Google only allows 2500

Mapquest is pretty low too (5000?)

Exploratus’s picture

Status: Closed (fixed) » Active

Sorry to reopen.

As with #6, I followed all the proper steps and not getting any geocoding. I noticed that I removed the Key, and I didn't even get the exception, so I am wondering if its even kicking off.

Exploratus’s picture

I guess Bing only supports proximity. Would be amazing if it supported on node save, as it permits by far the most geocodings a day.

aaronbauman’s picture

For anyone having trouble with Bing + addressfield, see here: #2094057: Bing geocoder doesn't work for postal address fields

aaronbauman’s picture

Issue summary: View changes

Gg

pol’s picture

Issue summary: View changes
Status: Active » Fixed

Hi,

This provider is now supported in Geocoder 2.x.
I will close this thread, feel free to reopen it if needed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.