-
Notifications
You must be signed in to change notification settings - Fork 1
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
infinite loading icon and js error on maps with GFW alerts #392
Comments
This is caused by a bug in a farmOS patch to the itamair/geophp library. See phayes/geoPHP#115 (comment) |
@peacog Curious: can you help me understand how you traced this issue to the geoPHP patch? What specifically is ending up in the JSON that causes the JavaScript syntax error in the screenshot above? |
Hi @mstenta! In my local dev environment I get a more useful error than the JS syntax error. The call to /assets/geojson/full/all (the Farm Asset GeoJSON view) fails with a 500 error and in the log I see the error
With that I was able to add a breakpoint in the Polygon->area() method and I worked out that there are a handful of point coordinates that get converted to scientific notation when cast from float to string. If you'd like to test it yourself I've attached one of the affected polygons. It would be nice to confirm that you get the same error. |
@peacog I created a new Water asset in my local farmOS instance, and copied and pasted the contents of that file into the textarea below the map in the Location tab of /asset/add/water, then saved it. When I visit the asset view page, or the farmOS dashboard, the polygon loads successfully. So I wasn't able to replicate the error. I am testing in the I wonder if this polygon is the one that was causing your issue? Or maybe it was a different one? |
I doubled checked @mstenta and that's definitely the polygon that fails in my env. Interestingly though, the polygon renders fine on the asset page, but the map also loads an all locations layer with the /assets/geojson/full/all view, and that's where I get the error. |
Hmm yea that's weird. In my environment I only have two polygons total in this local site, though. I wonder if you have others? Maybe it's actually a different one causing the issue? Or, maybe there's something else affecting things, like at the PHP environment configuration level. Are you testing in the farmOS Docker container? Or a different environment? Maybe there are configuration differences affecting things. 🤔 In your comment on phayes/geoPHP#115 (comment) you mentioned the number |
@mstenta In my local env I'm using ddev, and the live site is in a docker container.
The funny thing is, the polygon I shared with you contains 4.8343734164291E-5 but it doesn't fail for you. I think it might be a PHP version issue. I'm using PHP 8.1. A warning about exponential numbers was added in PHP 7.4 and it looks like it is now an error. See https://stackoverflow.com/a/66691695/272038 |
If I search for "4.8343734164291E-5" in the polygon you sent I do not get any hits. Are you sure you sent the correct polygon? I've tried the following, and there were no results with any:
The farmOS Docker image is currently on PHP 8.3. |
@peacog I wonder if you can use https://www.codeenigma.com/blog/composer-patches-patches-ignore I'm trying to think of a workaround for you, because it is unlikely that I'll have the time to investigate much deeper right now, and changing the patch that is included with farmOS core is too risky without proper thought and testing. |
@mstenta yeah, I sent the wrong polygon. This is the right one. It contains the coordinate Thanks very much for taking the time to test this 🙏 I'll try patches-ignore. |
Since there were only two points in asset/803 and asset/804 that had this problem we have removed the points. |
Two ajax loading icons are shown on maps with GFW alerts and one stays loading infinitely

There is a javascript error in the console

The text was updated successfully, but these errors were encountered: