Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit a669504

Browse files
jaxukchadly
authored andcommitted
Added place_id to GoogleAddress (#52)
1 parent 4d91592 commit a669504

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

Google/GoogleAddress.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ public class GoogleAddress : Address
1010
readonly GoogleAddressComponent[] components;
1111
readonly bool isPartialMatch;
1212
readonly GoogleViewport viewport;
13+
readonly string place_id;
1314

14-
public GoogleAddressType Type
15+
public GoogleAddressType Type
1516
{
1617
get { return type; }
1718
}
@@ -42,7 +43,7 @@ public GoogleAddressComponent this[GoogleAddressType type]
4243
}
4344

4445
public GoogleAddress(GoogleAddressType type, string formattedAddress, GoogleAddressComponent[] components,
45-
Location coordinates, GoogleViewport viewport, bool isPartialMatch, GoogleLocationType locationType)
46+
Location coordinates, GoogleViewport viewport, bool isPartialMatch, GoogleLocationType locationType, string place_id)
4647
: base(formattedAddress, coordinates, "Google")
4748
{
4849
if (components == null)
@@ -53,6 +54,7 @@ public GoogleAddress(GoogleAddressType type, string formattedAddress, GoogleAddr
5354
this.isPartialMatch = isPartialMatch;
5455
this.viewport = viewport;
5556
this.locationType = locationType;
56-
}
57+
this.place_id = place_id;
58+
}
5759
}
5860
}

Google/GoogleGeocoder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ private IEnumerable<GoogleAddress> ParseAddresses(XPathNodeIterator nodes)
353353
XPathNavigator nav = nodes.Current;
354354

355355
GoogleAddressType type = EvaluateType((string)nav.Evaluate("string(type)"));
356-
string formattedAddress = (string)nav.Evaluate("string(formatted_address)");
356+
string place_id = (string)nav.Evaluate("string(place_id)");
357+
string formattedAddress = (string)nav.Evaluate("string(formatted_address)");
357358

358359
var components = ParseComponents(nav.Select("address_component")).ToArray();
359360

@@ -376,7 +377,7 @@ private IEnumerable<GoogleAddress> ParseAddresses(XPathNodeIterator nodes)
376377
bool isPartialMatch;
377378
bool.TryParse((string)nav.Evaluate("string(partial_match)"), out isPartialMatch);
378379

379-
yield return new GoogleAddress(type, formattedAddress, components, coordinates, viewport, isPartialMatch, locationType);
380+
yield return new GoogleAddress(type, formattedAddress, components, coordinates, viewport, isPartialMatch, locationType, place_id);
380381
}
381382
}
382383

0 commit comments

Comments
 (0)