Problem/Motivation

In some situations, we've seen the same error described in #3099605: Multi-value WKT fields fail on data imported successfully via feeds.

Exception: Cannot construct Point. x and y should be numeric in Point->__construct() (line 31 of /app/vendor/phayes/geophp/lib/geometry/Point.class.php).

This seems to happen for WKT data that includes extra whitespace.

Steps to reproduce

1. Create a content type with a Geolocation Geometry - Geometry Collection field
2. Create a view where the WKT is displayed by views_geojson
3. Create a node with additional whitespace in the WKT - e.g. GEOMETRYCOLLECTION(point( -0.10541484476951268 51.81177293566151),MULTILINESTRING((-0.235605249869247 51.9235864606639, -0.20252967751423 51.8980710191329), (-0.177959252336217 51.8753906266609, -0.141103614569198 51.8404250215998), (-0.117478205744186 51.8186896454808, -0.08723768244817 51.7941192203028), (-0.02864666856214 51.7402532881818, -0.06739233903516 51.7761639095958, -0.041876897504147 51.7525385007708), (-0.015416439620134 51.7241880101808, 0.015769100028882 51.6977275522968)))
4. Visit the view

If the whitespace is removed, the problem no longer occurs.

e.g. if you edit the WKT and change point( -0 to POINT(-0, it is displayed as expected.

I think that this is an instance of https://github.com/phayes/geoPHP/issues/181

Proposed resolution

Catch and log any exceptions

Remaining tasks

User interface changes

API changes

Data model changes

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

malcomio created an issue. See original summary.

malcomio’s picture

Issue summary: View changes
malcomio’s picture

Issue summary: View changes
malcomio’s picture

Issue summary: View changes

I think that this is an instance of https://github.com/phayes/geoPHP/issues/181

Given that the composer.json for views_geojson refers to https://github.com/itamair/geoPHP, it's odd that we're getting this error, although I can see that our project declares a dependency on the phayes version directly for some reason, so maybe that's why we're seeing it.

Even if that's the reason we're seeing it, it would make sense to catch any exceptions.

malcomio’s picture

Status: Active » Needs review

jeffschuler’s picture

Status: Needs review » Fixed

Thanks @malcomio!

Agreed that this project is bundling itamair's fork of geoPHP (it sounds like you've identified that your phayes version is coming from elsewhere?), but the exception handling is more than welcome.

Merged into 1.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.