1

I'm using thi library "google-api-services-mapsengine" (version 1.18.0-rc) and when I try do make a select on Google Maps Engine using this code :

com.google.api.services.mapsengine.MapsEngine.Tables.Features.List aRequest = myObj.getInstance().mapsEngine.tables().features().list(ASSET_ID_USER).setMaxResults((long) 1000)
                    .setSelect("num_dept")
                    .setWhere("mail='"+email+"'");

I face this issue :

java.lang.IllegalArgumentException: key geometry
    at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:871)
    at com.google.api.client.json.JsonParser.parse(JsonParser.java:374)
    at com.google.api.client.json.JsonParser.parse(JsonParser.java:347)
    at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:87)
    at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
    at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)

2 Answers 2

1

After looking for what's wrong, i've found two things : 1/ To "solve" it, you must select the geometry field like this code : com.google.api.services.mapsengine.MapsEngine.Tables.Features.List aRequest = SocleGme.getInstance().mapsEngine.tables().features().list(ASSET_ID_USER).setMaxResults((long) 1000) .setSelect("num_dept,geometry") .setWhere("mail='"+email+"'");

2/ After some hours, i've found what's the problem, and it come from this class : package com.google.api.services.mapsengine.model; /** * ........ * ........ * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class Feature extends com.google.api.client.json.GenericJson {

  /**
   * The geometry member of this Feature.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private GeoJsonGeometry geometry;

You have to comment this line @com.google.api.client.util.Key to make this code working :

com.google.api.services.mapsengine.MapsEngine.Tables.Features.List aRequest = myObj.getInstance().mapsEngine.tables().features().list(ASSET_ID_USER).setMaxResults((long) 1000)
                        .setSelect("num_dept")
                        .setWhere("mail='"+email+"'");

It could be a good thing to fix it directly in the library.

Regards, Sebastien

0

This is an instance of this bug: https://code.google.com/p/google-api-java-client/issues/detail?id=867.

In the meantime, the best workaround is to either include 'geometry' in your select string, or to omit it completely. Do not change the generated client library, as you may not be able to upgrade to future versions without modifying your code and you may find unexpected side effects - in this case you may not be able to retrieve the geometry field at all.

EDIT: Oh, and Google like it when you 'star' the bugs to show that you're also affected.

EDIT2: This bug is now fixed, so grab a recent version of the Maps Engine client library (rev44 or higher) and see how it goes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.