Hi I wish to use osmtogeojson on a windows commandline to convert OSM data. I saw the usage section here (1) but unsure if that's relevant to windows. What does the $ signify? Do I need to perform the npm install? (1): https://github.com/tyrasd/osmtogeojson Edit: I've removed what I previously did as it would just confuse any future readers of this post. After a lot of head scratching I've finally got it to work, but probably not as intended. I downloaded & installed I then downloaded & extracted the full zip file from https://github.com/tyrasd/osmtogeojson although for this operation only the osmtogeojson.js is required. In the folder that contained my OSM data file (FHRS857en-GB.osm) I created a The .cmd file contains the line:
"C:\GeoJson\osmtogeojson" points to osmtogeojson.js. The path will need to be amended to suit where the .js file was placed. The.cmd file can be run by double clicking on it in Windows Exporer or running it from a command line. Supposedly the actual node.js file can be used to preform the same procedure, but I couldn't get it to work. I'm new to npm & didn't really understand what it does. The usage example at https://github.com/tyrasd/osmtogeojson added to the confusion making it appear the npm command has to be run every time a conversion is performed. Unless you're a developer who wants to keep lots of projects filed neatly & kept up to date I don't see the need for it. npm doesn't inform you where it's installing its files & creates configuration files that fail to locate the files they're trying to run, and giving the same name to different file types really doesn't help. Thanks to aseerel4c26 & maxerickson for their help. asked 14 Feb '16, 16:22 DaveF
showing 5 of 9
show 4 more comments
|
Likely the "$" there means the command prompt of a Unix-like system's command line interface (see https://en.wikipedia.org/wiki/Command-line_interface#Command_prompt ). And npm is the package manager for Node.js. From what I read, it seems that node.js also runs on Windows, so you should be able to use those commands too (after installing node.js, of course). answered 14 Feb '16, 16:39 aseerel4c26 ♦ |
You should use the command
npm install -g osmtogeojson
to install the command line program. npm does not expect you to download anything beforehand, so no need to specify a path for the install target (I guess depending on how you installed node and npm it may be necessary to specify the path to npm).The line `'C:\Users_\AppData\Local\Temp\npm-5464-54bc4da9\unpack-056e3c18416e\package.json' is saying that whatever you downloaded does not contain npm package information. I guess based on the name you downloaded something related to http://tyrasd.github.io/osmtogeojson/, but that is another way of using the code, from a webpage, and won't necessarily have anything to do with npm.
One of the reasons to use npm to install packages is that it will automatically fetch and install any libraries that a script might use. In this case, the script doesn't need any additional libraries, so it is possible to rip the script out of a package and run it directly, but people using node.js will still expect to be able to easily install the script by running the command
npm install -g osmtogeojson
.I've added
https://github.com/tyrasd/osmtogeojson/issues/50
Hi, I'm the dev of osmtogeojson.
Did you manage to get it to run in the end? If so, can you please post the steps you performed to do so? I can probably add these instructions/information to the github repo for other Windows users.
I've borrowed a Windows machine to check, the node installer installs itself and npm to the path, so a command like
npm install -g osmtogeojson
works just as expected, and osmtogeojson is immediately available once that completes. No additional fussing around needed.... and there is a (slightly cryptic) Windows section in https://www.npmjs.com/package/npm
Hi tyr_asd
I have got it to work, but I want to double check it's the best way to do it. As I said npm/node is new to me, so I maybe misunderstanding some of it main points.
Do you provide a package of overpass 'stuff' for npm to load? Can you dictate the file names? Having the .js & .cmd files both named 'osmtogeojson' is quite confusing when the command does specify the extension..
Hey Dave. Yes, I chose these file names and now I see that it can be indeed irritating. On the other hand, I've expected that most users would install the CLI tool via via
npm -g
, so I thought it doesn't matter ;-)When I come around to it, I'll put the different files in different directories (i.e. "executable"
osmtogeojson
intobin
, compiled libraryosmtogeojson.js
intodist
,sources intosrc
)…Thanks tyr_asd, that would clarify things. I would suggest putting a link to NPM Windows download page, but I'm sure they'd move it as soon as you did.
Yes SomeoneElse, cryptic is correct. There's few things NPM need to update on their site such as showing the correct folder it's installed to & linking to the easy to understand download page instead os the DOS style directory listing. It seems a bit ironic that a program to ensure packages are up to date has a convoluted procedure to update itself.
I'll add the procedure I followed shortly.