read and write attributes from GPX, KML, GeoRSS and GeoJSON
In current version, gpx is partially supported.
Does any plan exist for implementing to support full gpx specification?
Hi xdesktop, which elements do you consider missing?
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.
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.
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).
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.