Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoPoint is empty with ProtoBuf #152

Open
mdavemartin opened this issue Jan 17, 2017 · 2 comments
Open

GeoPoint is empty with ProtoBuf #152

mdavemartin opened this issue Jan 17, 2017 · 2 comments

Comments

@mdavemartin
Copy link

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)

@tomwalder
Copy link
Owner

sorry for the delay... This does sound like it's maybe an issue to do with your Schema (or lack of it).

Are you still having the problem?

@mdavemartin
Copy link
Author

I only got the GeoPoint object if it was present in the schema, otherwise it was not parsed (as in not present at all in the entity.)
I did not post the schema description, sorry for that.
Also, I had to back out the problem by having two separate float values.

Our team believes it was indeed Google itself since features that were functioning perfectly stopped working from one moment to the next. (Like I could not store an integer value larger than signed int32 in an integer field which was working fine before.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants