Problem/Motivation

When saving a node with a Geolocation Geometry - Geometry field, the save operation fails with a fatal error if we use a full GeoJSON "Feature" structure.
Error: Object of class stdClass could not be converted to string in Drupal\geolocation_geometry\GeometryFormat\GeoJSON::geometryByText() (line 32 of modules/contrib/geolocation/modules/geolocation_geometry/src/GeometryFormat/GeoJSON.php).

Steps to reproduce

Add a backend field of type Geolocation Geometry - Geometry to a Node bundle.
Enter

{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          3.9785224,
          50.9663602
        ],
        [
          3.983492,
          50.9664819
        ],
        [
          3.9823442,
          50.9627594
        ],
        [
          3.9654607,
          50.9631484
        ],
        [
          3.9691041,
          50.9775058
        ],
        [
          3.9841286,
          50.9721607
        ],
        [
          3.9785224,
          50.9663602
        ]
      ]
    ]
  }
}

Proposed resolution

Fix that line to properly serialize the nested geometry stdClass data object into a valid JSON text string

CommentFileSizeAuthor
#3 3613831-3.patch1.09 KBhmdnawaz
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hmdnawaz created an issue. See original summary.

hmdnawaz’s picture

Status: Active » Needs review
StatusFileSize
new1.09 KB

Patch from the MR

christianadamski made their first commit to this issue’s fork.

christianadamski’s picture

Status: Needs review » Fixed

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.