Skip to content

GeoPoint is empty with ProtoBuf #152

@mdavemartin

Description

@mdavemartin

Hi everyone,

I have an app which uses an entity with a GeoPoint property.

The app worked perfectly on the local env, however as I started to test it on the app engine itself, the property was always NULL/Empty, depending on the object type.

I traced the issue back to this section:

GDS/Mapper/ProtoBuf.php:

    /**
     * Extract a Geopoint value (lat/lon pair)
     *
     * @param \google\appengine\datastore\v4\Value $obj_property
     * @return Geopoint
     */
    protected function extractGeopointValue($obj_property)
    {
        $obj_gp_value = $obj_property->getGeoPointValue();
        return new Geopoint($obj_gp_value->getLatitude(), $obj_gp_value->getLongitude());
    }

I added the following line to this function for debug purposes:

die('<pre>'.var_export($obj_property,true).'<br/><br/>'.var_export($obj_property->getGeoPointValue(),true).'</pre>');

which yielded the following result:

google\appengine\datastore\v4\Value::__set_state(array(
   'list_value' => 
  array (
  ),
   'entity_value' => 
  google\appengine\datastore\v4\Entity::__set_state(array(
     'property' => 
    array (
      0 => 
      google\appengine\datastore\v4\Property::__set_state(array(
         'deprecated_value' => 
        array (
        ),
         'name' => 'x',
         'value' => 
        google\appengine\datastore\v4\Value::__set_state(array(
           'list_value' => 
          array (
          ),
           'double_value' => 47.527492000000002,
           'indexed' => false,
        )),
      )),
      1 => 
      google\appengine\datastore\v4\Property::__set_state(array(
         'deprecated_value' => 
        array (
        ),
         'name' => 'y',
         'value' => 
        google\appengine\datastore\v4\Value::__set_state(array(
           'list_value' => 
          array (
          ),
           'double_value' => 19.043243,
           'indexed' => false,
        )),
      )),
    ),
  )),
   'meaning' => 9,
))

google\appengine\datastore\v4\GeoPoint::__set_state(array(
))

GeoPoint properties worked on the local test environment with the RESTv1 Mapper, which I had to use for development.

Any thoughts on this? Does this feel like Google's side or could there be something that I missed?

(Yes, the property has the GeoPoint type. It is indexed despite the fact that the dump says it is not.)

Additional info: At first, I didn't define a fixed schema for a store, just allowed auto recognition and the GeoPoint property came back as NULL. (Not parsed, as NULL is parsed as (0,0) in GeoPoint)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions