geoPHP icon indicating copy to clipboard operation
geoPHP copied to clipboard

read and write attributes from GPX, KML, GeoRSS and GeoJSON

Open xdesktop opened this issue 13 years ago • 5 comments

In current version, gpx is partially supported.

Does any plan exist for implementing to support full gpx specification?

xdesktop avatar May 07 '12 04:05 xdesktop

Hi xdesktop, which elements do you consider missing?

phayes avatar May 07 '12 15:05 phayes

Hi phayes,

I am developing a module for openlayers in drupal.

The goal is representing gpx on openlayers using geophp for converting gpx file to openlayers features.

At first, I try to read gpx file using geophp.

I expect to read all of attributes( e.g name,desc, and time in waypoint ), however, the library returns only lat, lon attributes.

xdesktop avatar May 08 '12 04:05 xdesktop

Hi xdesktop,

No, geoPHP will never read those other attributes. It is concerned only with geometries. You're going to have to write your own GPX parser for that.

phayes avatar May 08 '12 13:05 phayes

I've thought about this a bit more actually, and I think it makes sense for geoPHP to provide general GPX, KML, geoRSS, and GeoJSON parsing abilities (attributes and all). While it was not part of the original plan with my vision for geoPHP, there is no other PHP library that does this, and so it makes sense to be in geoPHP.

So basically we should be able to extract GPX attributes and put them in $geom->data[]. (See here: https://github.com/phayes/geoPHP/issues/19)

I don't have the time or energy to do this, but would be willing to accept a pull request that adds reading and writing data attributes for GPX (and KML, GeoJSON and GeoRSS for that matter).

phayes avatar May 08 '12 14:05 phayes

Reading the GeoJSON spec it looks to me like the correct way to do this would be to implement support for Feature and FeatureCollection. WPT's in GPX would then map onto a Feature which would contain the Point along with the properties of the feature.

Yermo avatar Apr 17 '16 16:04 Yermo