[OSM-dev] XAPI and other solutions
Oliver Tonnhofer
olt at omniscale.de
Thu Apr 28 13:30:01 BST 2011
On 28.04.2011, at 13:57, Pierre-Alain Dorange wrote:
>> What kind of processing were you doing? I'm assuming some kind of XML
>> (unless you were using the protobuffs). If thats the case, you can use
>> a simple SAX parser. If you need an example, I'll send you one.
>
> Yes i preprocess XML to extract city data (place=town, place=village,
> etc...) to match them with an official source with population data.
> For that i uses elementTree lib (python) that's fine.
> I don't know about SAX, but i just see that contrary to DOM technique it
> do not need to load the whole XML into memory, so it can be helpful if i
> swtich to huge XML data file.
> I'll check.
If you are using Python, you should use iterparse from the ElementTree API, it is much nicer and faster.
Here is a complete OSM parser from an earlier version of Imposm:
http://pastie.org/1843106
It just <40 lines of code and can parse arbitrary large OSM files.
Regards,
Oliver
--
Oliver Tonnhofer | Omniscale GmbH & Co KG | http://omniscale.de
http://mapproxy.org | https://bitbucket.org/olt | @oltonn
More information about the dev
mailing list