Skip to content

Expose the <bounds> element in osmxml #6

@WillSewell

Description

@WillSewell

OSM XML files have a <bounds> as one of the first elements. This is not currently exposed by the osmxml.Scanner. I think there are two ways of doing this:

  1. Object returns an interface{} instead of osm.Object, so it can return *osm.Bounds
  2. Add a new Bounds method, a bit like osmpbf.Scanner.Header. This might be nicer from an API point of view, but introduces significantly more complexity. E.g. the osmxml.Scanner now needs two states: the state when it is scanning for the <bounds> and the state where it is doing regular scanning with Scan. This is tricky to get right because it's not well-defined where in the document the <bounds> element should be. We could define it as "before an element recognised by the Scan method. But this would require some lookahead (in case the element doesn't exist. (an option is to require all documents to contain a <bounds> element at a particular location).

@paulmach have you thought about this at all?

For reference, an example OSM XML file with <bounds>:

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API 0.7.55.7 8b86ff77">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2019-09-12T17:16:02Z"/>

  <bounds minlat="51.4072000" minlon="-0.2907000" maxlat="51.5913000" maxlon="0.1659000"/>

  <node id="1" lat="51.4779481" lon="-0.0014863" version="20" timestamp="2018-10-31T10:20:19Z" changeset="64040630" uid="1778799" user="SomeoneElse_Revert"/>
  <node id="78112" lat="51.5269760" lon="-0.1457924" version="3" timestamp="2018-10-15T14:49:44Z" changeset="63545352" uid="486343" user="peregrination"/>
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions