pear / Services_Openstreetmap

Makes communicating with the Open Street Map API, and Nominatim, from PHP intuitive.
https://pear.php.net/package/Services_OpenStreetMap/
BSD 3-Clause "New" or "Revised" License
202 stars 53 forks source link

Changeset and setTag #128

Closed PanierAvide closed 1 year ago

PanierAvide commented 3 years ago

Hello,

I started using this library (1.0.0RC2), which is really helpful. I can't figure if there is a way yet to change changeset tags. I tried :

$osm = new Services_OpenStreetMap([...]);
$changeset = $osm->createChangeset();
$changeset->begin(...);
$changeset->setTag('host', '...');
...
$changeset->commit();

And defined tags are not applied. I also tried $changeset->add($changeset); to mimic other objects behaviour, but this causes an infinite loop. I'm not sure if setting custom tags on changesets is not permitted yet by the library, or if I missed how to use it.

By reading current code, I understand that most of changeset tags are hard-written in begin method. If this is not supported, one simple solution could be to add a tags parameter to this function and append custom tags to existing ones. One more complex solution could be to handle PUT HTTP call on changesets.

Best regards.

sascha-hendel commented 1 year ago

I need to add custom tags to the changeset, too. Right now changeset tags are indeed hardcoded as @PanierAvide mentioned. Implementation of a setTag method for changeset similar to item would be nice! @kenguest do You still maintain this project? I could create a fork and try to do the implementation. Would You merge the fork if things working? (I only spent my time therefore if there is a chance that the result will go into the main fork)

kenguest commented 1 year ago

Yes @sascha-hendel - if you implement the changes in your fork I'll be happy to merge your pull request :-)

Nice to see there's still some interest in this package ;-)

sascha-hendel commented 1 year ago

Thanks for the immediate reply! Ok, I will have a deeper look on the code in some weeks and hopefully extend the code to support individual changeset tags.

sascha-hendel commented 1 year ago

Tested my fork with a setTag method for changeset now for a while. Seems to work. Pull request (#214) created.

kenguest commented 1 year ago

Closing as pr #214 has addressed this, thanks to @sascha-hendel !!