Get GeoPoint by Criteria ID

164 views
Skip to first unread message

Dzmitry Zahusta

unread,
Jul 30, 2014, 9:28:20 AM7/30/14
to adwor...@googlegroups.com
Hi!

Is it possible to get GeoPoint by Criteria ID? I mean Criteria ID that can be found here.

Josh Radcliff (AdWords API Team)

unread,
Jul 30, 2014, 9:45:31 AM7/30/14
to adwor...@googlegroups.com
Hi,

Yes, you can use the LocationCriterionService where your Selector has a predicate based on the Id field. See the example request below.

Cheers,
Josh, AdWords API Team

      <selector>
        <fields>Id</fields>
        <fields>LocationName</fields>
        <fields>CanonicalName</fields>
        <fields>DisplayType</fields>
        <fields>ParentLocations</fields>
        <fields>Reach</fields>
        <fields>TargetingStatus</fields>
        <predicates>
          <field>Id</field>
          <operator>IN</operator>
          <values>2276</values>
          <values>2278</values>
        </predicates>
        <predicates>
          <field>Locale</field>
          <operator>EQUALS</operator>
          <values>en</values>
        </predicates>
        <ordering>
          <field>LocationName</field>
          <sortOrder>ASCENDING</sortOrder>
        </ordering>
      </selector>
    </get>

Dzmitry Zahusta

unread,
Jul 30, 2014, 4:22:02 PM7/30/14
to adwor...@googlegroups.com
Using LocationCriterionService I can get only list of Location criterion and unfortunately it has nothing to do with GeoPoint objects...  

среда, 30 июля 2014 г., 16:45:31 UTC+3 пользователь Josh Radcliff (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Jul 30, 2014, 6:29:18 PM7/30/14
to adwor...@googlegroups.com
Hi,

The IDs in the link you provided are for creating Location criteria, not GeoPoint criteria. If you are instead interested in GeoPoint objects, you can look those up by address using GeoLocationService, but not by ID. GeoPoints do not have IDs -- just latitudeInMicroDegrees and longitudeInMicroDegrees.

If you are looking to find GeoPoint information for a given Proximity criterion, you can simply include the field "GeoPoint" in your Selector when you issue a CampaignCriterionService.get.

Regards,
Josh, AdWords API Team

Dzmitry Zahusta

unread,
Aug 26, 2015, 8:29:03 AM8/26/15
to AdWords API Forum
Hi Josh,

I did as you suggested here to get GeoPoint object for Proximity criterion:
       
        Address address = new Address();
        address
.setCityName("Fairfield");
        address
.setCountryCode("US");
        address
.setProvinceName("California");


       
GeoLocationSelector selector = new GeoLocationSelector();
        selector
.setAddresses(new Address[] {address});


       
GeoLocation[] geoLocationResult = geoLocationService.get(selector);

But for some reason it has stopped working correctly recently for several addresses:
  • Marina,California,United States
  • Napa,California,United States
  • Orange,Orange,California,United States
  • and many others addresses
GeoLocationService return InvalidGeoLocation for these addresses.

What is different way to get correct GeoLocation if you know address GeoLocationService is not working as expected?

четверг, 31 июля 2014 г., 1:29:18 UTC+3 пользователь Josh Radcliff (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Aug 26, 2015, 10:41:49 AM8/26/15
to AdWords API Forum
Hi,

That's odd -- I confirmed that these appear to be valid city/state/country combinations, but I'm getting InvalidGeoLocation for them as well. I've raised this issue and will get back to you as soon as I have an update.

Thanks,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
Dec 9, 2015, 4:58:18 PM12/9/15
to AdWords API Forum
Hi Dzmitry,

It turns out that those locations aren't being recognized as valid due to some quirks in the underlying look up. Since this only impacts a small number of addresses, I don't expect this to be fixed in the immediate future.

In the meantime, you can work around this problem by including a valid street name in your address.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages