Generate <modify> blocks for nodes and add a few tests#2
Conversation
- allow to match features using keys from GeoJSON `feature` object, not necessarily from `features["properties"]` - remove all `@props` from GeoJSON feature properties - if needed, call OSM API to get all data of reference objects - basic protection to prevent unwanted overrides - log: show count of creation/deletion/modifications etc
Sure, go ahead.
I'm not sure if this will work, because from what I can see in the code, currently "LineString" and "Polygon" geometries are supported, and the equivalent of a polygon in OSM could be a Relation, which is not supported due to its complexity and lack of support in geojson.
If you feel like doing it and see a use for it, why not? |
| stats = {"ignored_updates": [], "modifications": 0} | ||
|
|
||
| if update_from_api: | ||
| ref = osmApi.elements.get(Node, ref.id) |
There was a problem hiding this comment.
More optimal solution would be to create list of all id's we have to download and then use one api call https://docentyt.github.io/osm_easy_api/osm_easy_api/api/endpoints/elements.html#Elements_Container.get_query
There was a problem hiding this comment.
Way better indeed ! Now objects are downloaded by batch of 100
- allow to download from api even if --modify=false - download by batch, not one by one - simplify comparison between nodes - add an option to use a custom user agent - use @properties from geojson as metadata for osm objects
|
I successfully generated a first changeset with theses modifications (opened and uploaded with josm) I separated I don't know how to do it for now but I'd like to add a "no upload" tag to the generated changeset in case of modifications on objects without downloading full object data from osm, as in can lead to unwanted removal of some attributes if not present in the ref file |
|
This pull request is still marked as "work in progress". |
|
Indeed sorry, I'd like to reduce the log related code first, then I'll mark it as ready
Le 20 mars 2026 23:46:05 GMT+01:00, Christopher Kwiatkowski ***@***.***> a écrit :
…docentYT left a comment (docentYT/OsmChange-generator-cli#2)
This pull request is still marked as "work in progress".
You are still working on it, and I should wait until you finish?
--
Reply to this email directly or view it on GitHub:
#2 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
Hi @docentYT,
As discussed previously, here is a first draft with my changes to handle modifications, and a basic shell script with a few examples.
About objects
id: the GeoJSON spec asks for anidproperty in each feature (not inproperties) if there is such an id, and Overpass which seems to useosmtogeojsoncorrectly set thisid(also seeexample/ara_small.osm.geojsonwich is an export from Overpass), so if you're ok with this I'll remove the code to handlefeature["properties"]["@id"]and instead I will only parsefeature["id"].Also, maybe I could parse the object type from the osm id if present, what do you think ? Or even all available properties which are not tags (eg
@user,@version)I put a basic test script here but if you prefer I can open another pr for this. Maybe it can be better to have an example folder with 1 or 2 simple example, and a test folder with more specific cases. But I'm not sure this simple script will be helpful for more complex scenarios, for example the tests which calls the OSM API may fail simply because someone updated an object