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

Multiple coordinates on the same line throws fatal error #151

Open
MappingSupport opened this issue Jul 4, 2018 · 1 comment
Open

Multiple coordinates on the same line throws fatal error #151

MappingSupport opened this issue Jul 4, 2018 · 1 comment

Comments

@MappingSupport
Copy link

First, thank you for geoPHP. I am another Google map API dev that is converting to Leaflet. Alas, Leaflet lacks native support for KML/KMZ.

Once a day several KMZ files are produced and hosted on a federal FTP server. I need to display this data on a map in the browser. I manually converted one KMZ file to KML and then wrote a short PHP script to convert the KML to geoJSON using geoPHP. That conversion failed for the reason that coordinates.../coordinates is one looong csv string. Not a line break in sight.

It has been my experience that this way of presenting coordinates is quite common.

I modified the pentagon.kml file that comes with geoPHP so coordinates.../coordinates is one long csv string. Then I made a short script to demonstrate the error message.

File: https://mappingsupport.com/p/bug_report/pentagon_fail.kml

Script: https://mappingsupport.com/p/bug_report/simple_geophp_test.php

Error message: PHP Fatal error: Uncaught exception 'Exception' with message 'Cannot construct a LineString with a single point' in /home/mapping1/usr/geophp/lib/geometry/LineString.class.php:18

@BathoryPeter
Copy link

Your kml is invalid, coordinate tuples must not be separated with comma.
https://developers.google.com/kml/documentation/kmlreference#coordinates
Specification requires new line as separator, but I think geoPHP understands white spate too.

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