NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi! I found the source code of osmconvert in the following page:

However, there seems to be something special about this script. Normally, C is written in separate files while linked with headers. It is very difficult to find a C script with over 10000 lines.

What is more peculiar is that the term 'module' is used, which is a Python concept. There is nothing called 'module' in C. Therefore, I am suggesting that it is originally written in Python, and then translated to C. If that is the case, can the developer please open the Python source code and the way to translate Python to C? Thanks.

P.S. The new version of osmconvert does not write object visibility. Is that a bug?

asked 14 Mar '17, 15:22

Wetitpig0's gravatar image

accept rate: 10%

closed 29 Dec '17, 04:29

(14 Mar '17, 20:32) aseerel4c26 ♦

How to contribute to osmconvert?

(15 Mar '17, 05:00) Wetitpig0

@Wetipig0 I guess clone and send a merge request ? Given the look of the code, I'm not surprised that it's basically a one-man-show: :/

(15 Mar '17, 10:51) Vincent de P... ♦

@Vincent de P: oh, I missed that one on the wiki page of osmconvert. It was quite well hidden under "downloads".

(15 Mar '17, 18:35) aseerel4c26 ♦

meta @Wetitpig0: please could you ask your second (side)question in a new question entry (and delete that part here)? Thanks!

(15 Mar '17, 21:23) aseerel4c26 ♦
showing 5 of 6 show 1 more comments

The question has been closed for the following reason "The question is answered, right answer was accepted" by Wetitpig0 29 Dec '17, 04:29

Yes, this is pure C and definitely not something translated from Python. Like pretty much any programming language from the last 50 years, C supports modularization, it just doesn't have a keyword called "module". Being the huge monolithic source that it is, osmconvert (or rather its author) doesn't seem to be all that fond of this module concept which makes it hard to understand and change indeed. By modularizing it and using the standard library plus some external XML library, it culd probably be cut down by a large amount.

I'm afraid I have no idea about the visibility issue, it looks like that's simply not yet supported.

permanent link

answered 15 Mar '17, 04:05

mbethke's gravatar image

accept rate: 50%


Thanks to mbethke! I'd like to confirm that the program is written in plain C. You can split the source file into pieces, of course, I just failed to see the advantage in having the modules moved to separate files. The modules will stay modules, no matter if they are in the same file or not.

(15 Mar '17, 19:52) Marqqs

Actually, generally, it is a good idea to break a C (or C++) program in "modules." Actually, this is true of any language that creates linkable object files. (Even, Assembler, COBOL and FORTRAN (A half century in the field and having used all five of the mentioned languages.).)

A good reason is to keep private values and routines private by not declaring them public or external.

(15 Mar '17, 23:37) OverThere

Also agreed. That is why osmconvert in fact uses modules with private variables, private functions, etc. The only specialty here is that these modules have been placed into a single source file – like C++ classes, for example.

(16 Mar '17, 09:45) Marqqs

Btw, Marqqs can u include a directory listing for so that we can look for the programs more easily?

(31 Dec '17, 16:33) Wetitpig0

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 14 Mar '17, 15:22

question was seen: 2,950 times

last updated: 31 Dec '17, 16:33

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum