[Talk-ca] Shp2osm progress?

Sam Vekemans acrosscanadatrails at gmail.com
Thu Feb 12 22:22:15 GMT 2009


Yuppee!!
It worked!. ..

I created an OSM file!..
Now i just need to play around using different shape files, and changing the
rules.

Your awesome!!

I'll get back to you once i figure out some more. ;)

Look forward to seeing how the tests work out.

Cheers
Sam

P.S. and to talk-ca list, once i figure it out, i'll write it on the Wiki
for shp2osm



On Thu, Feb 12, 2009 at 1:59 PM, Ian Dees <ian.dees at gmail.com> wrote:

> Yes, the standard (or at least the way all the tools I've seen work) is
> that the .shp and .prj files need to have the same name.
>
>
> On Thu, Feb 12, 2009 at 3:57 PM, Sam Vekemans <
> acrosscanadatrails at gmail.com> wrote:
>
>> Well, I do have the matching .prj file092f04_3_0_BS_2010009_0.prj
>> So, I assume that both the .shp and the .prj file needs to have the same
>> name?
>>
>> Fortunately, i do understand what map "projection" means. :-)
>>
>> Sam
>>
>>
>> On Thu, Feb 12, 2009 at 1:48 PM, Ian Dees <ian.dees at gmail.com> wrote:
>>
>>> I'm glad you got it to work that far.
>>>
>>> sourceCRS is null because you have no .prj projection file in the same
>>> directory as the .shp file, which means it can't reproject the points from
>>> whatever projection they're in to the required WGS84. I suppose I could make
>>> a switch to turn reprojection off, but it's fairly important to get right,
>>> especially on big imports like the one you're doing.
>>>
>>> What many-to-many relationship are you talking about?
>>>
>>> This 0.2 version of shp-to-osm should support point features, but I
>>> haven't tested it with a point-only shapefile yet.
>>>
>>>
>>> On Thu, Feb 12, 2009 at 3:44 PM, Sam Vekemans <
>>> acrosscanadatrails at gmail.com> wrote:
>>>
>>>> Ok, well it's version 1.6 so thats cool.
>>>> has the same error
>>>>
>>>> Exception in thread "main" java.lang.NoClassDefFoundError: Main
>>>> Caused by: java.lang.ClassNotFoundExeption: Main
>>>> at java.net.URLClassLoader$1.run<Unknown Source>
>>>> at java.security.AccessController.doPrivileged<Native Method>
>>>> at java.net.URLClassLoader.findClass<Unknown Source>
>>>> at java.lang.ClassLoader.loadClass<Unknown Source>
>>>> at sun.misc.Launcher$AppClassLoader.loadClass <Unknown Source>
>>>> at java.lang.ClassLoader.loadClass<Unknown Source>
>>>> at java.lang.ClassLoader.loadClassUnternal<Unknown Source>
>>>> Could not find the main class: Main.  Program will now exit.
>>>>
>>>> So i used
>>>> java -cp
>>>> shp-to-osm-0.2.jar:lib/gt-epsg-wkt-2.5-M3.jar:lib/gt-shapefile-2.5-M3.jar:lib/log4j-1.2.12.jar;lib/gt-epsg-extension-2.5-M3.jar;lib/commons-lang-2.1.jar;lib/jsr-275-1.0-beta-2.jar;lib/jts-1.9.jar;lib/gt-api-2.5-M3.jar;lib/jai_core.jar;lib/gt-metadata-2.5-M3.jar;lib/gt-referencing-2.5-M3.jar;lib/geoapi-2.2-M1.jar;lib/gt-main-2.5-M3.jar
>>>> Main d:/canvec2osm/watertower.shp d:/canvec2osm/rules.txt
>>>> d:/canvec2osm/canvec.osm
>>>>
>>>> ***
>>>> So then i changed the ":" to a ";" that seemed to work.
>>>> It choked just after
>>>>
>>>> Converting from null to GEOGCS[WGS 84",
>>>> ....7 lines
>>>> Authority["EPSG","4326"]]
>>>>
>>>> It says the Argument "sourceCRS"  should not be null..
>>>>
>>>> ***
>>>> Im going to try it using different shape files, as you said it doesnt
>>>> work with shape files that are just points.
>>>> ..
>>>>
>>>> Happy I got that far, :)
>>>>
>>>> So anyway,
>>>> John Peterson Is also working on a script (latest talk-ca list), which
>>>> deals with the many-to-many relationship, where im trying to get the "ignore
>>>> what else is there, and just import the shape"
>>>>
>>>> Since i uncovered this new onion layer, are there any jar files that the
>>>> program can work without?
>>>>
>>>> Thanks,
>>>> Sam
>>>>
>>>> On Thu, Feb 12, 2009 at 12:45 PM, Ian Dees <ian.dees at gmail.com> wrote:
>>>>
>>>>> None of those things will cause the error you are seeing.
>>>>>
>>>>> Try these exact steps please:
>>>>>
>>>>> 1. Open a command prompt via Start > Run... "cmd"
>>>>> 2. Use "cd" to change directory to the directory that contains the
>>>>> shp-to-osm-0.2.jar file. This directory should have been created when you
>>>>> expanded the .zip you downloaded from my website. It should have the "lib"
>>>>> directory in it.
>>>>> 3. Type "java -version". You should see a short (3 line) output. One
>>>>> line should contain the version of java which should be at least 1.5.
>>>>> 4. Then, copy and paste the following command into the cmd.exe window:
>>>>>
>>>>> java -cp
>>>>> shp-to-osm-0.2.jar:lib/gt-epsg-wkt-2.5-M3.jar:lib/gt-shapefile-2.5-M3.jar:lib/log4j-1.2.12.jar;lib/gt-epsg-extension-2.5-M3.jar;lib/commons-lang-2.1.jar;lib/jsr-275-1.0-beta-2.jar;lib/jts-1.9.jar;lib/gt-api-2.5-M3.jar;lib/jai_core.jar;lib/gt-metadata-2.5-M3.jar;lib/gt-referencing-2.5-M3.jar;lib/geoapi-2.2-M1.jar;lib/gt-main-2.5-M3.jar
>>>>> Main <path to input shapefile> <path to rules file> <path to output osm
>>>>> file>
>>>>>
>>>>> And then (if it doesn't work), copy the exact output from the command
>>>>> prompt, and paste it in an e-mail back to me.
>>>>>
>>>>>
>>>>> On Thu, Feb 12, 2009 at 2:20 PM, Sam Vekemans <
>>>>> acrosscanadatrails at gmail.com> wrote:
>>>>>
>>>>>> Dout, A little googling is supposed to FIND the answer, yet it made me
>>>>>> more confused. :) That switch didn't work, unfortunatly. .. however,
>>>>>> a few things that might help.
>>>>>> Each time i logged off and shut down the computer, i got the error
>>>>>> "WJView.exe" (or something like that) - file not responding, so i just hit
>>>>>> 'end now' it's always anoying.
>>>>>>
>>>>>> The problem could be this;
>>>>>> When windows or myself updates to a new java version, it doesnt wipe
>>>>>> out the old java version, so to remove the access waste. (unneeded files)
>>>>>>  so when running the script, it calls on an old version of java?
>>>>>>
>>>>>> It tells me that i have "Java Quick Starter" running, as part of the
>>>>>> msconfig.sys, is this similar to "javaw.exe" or "WJView.exe"
>>>>>>
>>>>>> BTW (Im using an EEE pc with windows XP) if that helps.
>>>>>>
>>>>>> Thanks,
>>>>>> Sam
>>>>>>
>>>>>>
>>>>>> On Thu, Feb 12, 2009 at 5:23 AM, Ian Dees <ian.dees at gmail.com> wrote:
>>>>>>
>>>>>>> It looks like I copied the wrong command to you. Please try the
>>>>>>> following:
>>>>>>>
>>>>>>> java -cp shp-to-osm-0.2.jar:lib/gt-epsg-wkt-2.5-M3.jar:lib/gt-shapefile-2.5-M3.jar:lib/log4j-1.2.12.jar:lib/gt-epsg-extension-2.5-M3.jar:lib/commons-lang-2.1.jar:lib/jsr-275-1.0-beta-2.jar:lib/jts-1.9.jar:lib/gt-api-2.5-M3.jar:lib/jai_core.jar:lib/gt-metadata-2.5-M3.jar:lib/gt-referencing-2.5-M3.jar:lib/geoapi-2.2-M1.jar:lib/gt-main-2.5-M3.jar
>>>>>>> Main <path to input shapefile> <path to rules file> <path to output osm
>>>>>>> file>
>>>>>>>
>>>>>>> This time, the correct version of the shp-to-osm jar is in the
>>>>>>> command line (last time it was 0.1, this time 0.2).
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Feb 12, 2009 at 1:23 AM, Sam Vekemans <
>>>>>>> acrosscanadatrails at gmail.com> wrote:
>>>>>>>
>>>>>>>> Interesting,
>>>>>>>> it says;
>>>>>>>>
>>>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError: Main
>>>>>>>> Caused by: java.lang.ClassNotFoundExeption: Main
>>>>>>>> at java.net.URLClassLoader$1.run<Unknown Source>
>>>>>>>> at java.security.AccessController.doPrivileged<Native Method>
>>>>>>>> at java.net.URLClassLoader.findClass<Unknown Source>
>>>>>>>> at java.lang.ClassLoader.loadClass<Unknown Source>
>>>>>>>> at sun.misc.Launcher$AppClassLoader.loadClass <Unknown Source>
>>>>>>>> at java.lang.ClassLoader.loadClass<Unknown Source>
>>>>>>>> at java.lang.ClassLoader.loadClassUnternal<Unknown Source>
>>>>>>>> Could not find the main class: Main.  Program will now exit.
>>>>>>>>
>>>>>>>> ....
>>>>>>>> So it looks like it didn't like the 'Main' key,
>>>>>>>> I tried those different combinations, which didn't work either.
>>>>>>>>
>>>>>>>> It's probably the 'rules.txt. as the file im using uses a number
>>>>>>>> system for each map feature as it's map type. .. I just figured out
>>>>>>>> how to add in other fields in the shape file.
>>>>>>>> What specific fields are needed for the shape file to work?
>>>>>>>>
>>>>>>>>
>>>>>>>> Hope that helps,
>>>>>>>> Sam
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Feb 11, 2009 at 9:50 PM, Ian Dees <ian.dees at gmail.com>wrote:
>>>>>>>>
>>>>>>>>> Yes, that should be fine. Make sure you're running the following
>>>>>>>>> command:
>>>>>>>>>
>>>>>>>>> java -cp
>>>>>>>>> shp-to-osm-0.1.jar:lib/gt-epsg-wkt-2.5-M3.jar:lib/gt-shapefile-2.5-M3.jar:lib/log4j-1.2.12.jar:lib/gt-epsg-extension-2.5-M3.jar:lib/commons-lang-2.1.jar:lib/jsr-275-1.0-beta-2.jar:lib/jts-1.9.jar:lib/gt-api-2.5-M3.jar:lib/jai_core.jar:lib/gt-metadata-2.5-M3.jar:lib/gt-referencing-2.5-M3.jar:lib/geoapi-2.2-M1.jar:lib/gt-main-2.5-M3.jar
>>>>>>>>> Main <path to input shapefile> <path to rules file> <path to output osm
>>>>>>>>> file>
>>>>>>>>>
>>>>>>>>> (This is slightly different than the readme: the readme.txt is
>>>>>>>>> missing the "Main" after the list of jars for the classpath)
>>>>>>>>>
>>>>>>>>> Some tips:
>>>>>>>>> 1. The above command assumes you are starting it in the directory
>>>>>>>>> that contains "shp-to-osm-0.2.jar" and the "lib" directory.
>>>>>>>>> 2. If there are spaces in your shapefile, rules, or output file
>>>>>>>>> paths, you need to put quotes around the path.
>>>>>>>>> 3. Try using / instead of \ for windows paths.
>>>>>>>>>
>>>>>>>>> If that doesn't work, let me know. Send me the exact message you
>>>>>>>>> get.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Feb 11, 2009 at 11:40 PM, Sam Vekemans <
>>>>>>>>> acrosscanadatrails at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Cool, thats the one that's called shp-to-osm-0.2  right?
>>>>>>>>>>
>>>>>>>>>> It looks like i just need to change the 'rules.txt' file
>>>>>>>>>>
>>>>>>>>>> Then, does it matter what format the shp file is in?
>>>>>>>>>>
>>>>>>>>>> Does it matter if it's on the C: drive or D: drive?
>>>>>>>>>> "D:\canvec2osm\canvec.shp"
>>>>>>>>>> if all the jar files are in the d:\canvec2osm\lib
>>>>>>>>>> and the rules file is in the
>>>>>>>>>> d:\canvec2osm\rules.txt
>>>>>>>>>>
>>>>>>>>>> im not sure why it doesn't work.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Sam
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Feb 11, 2009 at 8:13 PM, Ian Dees <ian.dees at gmail.com>wrote:
>>>>>>>>>>
>>>>>>>>>>> The links you give are not the file I am linking to. The file
>>>>>>>>>>> you're looking at is a Python script, the file I wrote is a Java
>>>>>>>>>>> application.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Feb 11, 2009 at 10:12 PM, Sam Vekemans <
>>>>>>>>>>> acrosscanadatrails at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Thanks,Ya, thats the one i am looking at.  Unfortunately i
>>>>>>>>>>>> can't figure it out :)
>>>>>>>>>>>> as it doesn't recognize the shape files im using.  (needs to be
>>>>>>>>>>>> converted to the write type of shape file.
>>>>>>>>>>>> ...
>>>>>>>>>>>> Im looking at
>>>>>>>>>>>> http://article.gmane.org/gmane.comp.gis.openstreetmap/32835
>>>>>>>>>>>>
>>>>>>>>>>>> as it has a little more detail instruction, but still a bit
>>>>>>>>>>>> complex. ;-)
>>>>>>>>>>>>
>>>>>>>>>>>> I created a wiki so to share the instructions
>>>>>>>>>>>> http://wiki.openstreetmap.org/wiki/Shp2osm
>>>>>>>>>>>>
>>>>>>>>>>>> I also see a blog post
>>>>>>>>>>>> http://crschmidt.net/blog/354/polyshp2osm/
>>>>>>>>>>>>
>>>>>>>>>>>> So I think it's work creating a wiki page with a little more
>>>>>>>>>>>> concrete description.  It was created for the MassGIS import and used for
>>>>>>>>>>>> others, but i think that the basic script could be written which would
>>>>>>>>>>>> include discribing how to edit the script to work to convert a shape to an
>>>>>>>>>>>> OSM shape.
>>>>>>>>>>>>
>>>>>>>>>>>> I still need to go through it in detail, so I'll copy the
>>>>>>>>>>>> instructions that i find on the pages.  But first I'll wait i hear from you.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> Sam
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Feb 11, 2009 at 7:21 PM, Ian Dees <ian.dees at gmail.com>wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> On Wed, Feb 11, 2009 at 6:35 PM, Sam Vekemans <
>>>>>>>>>>>>> acrosscanadatrails at gmail.com> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi, wondering if there is any progress on the script?
>>>>>>>>>>>>>> I'm looking to make the wiki more simpiler to show the
>>>>>>>>>>>>>> process.
>>>>>>>>>>>>>> I downloaded python, but im lost as to how to make it work.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> There are a couple others, but take a look at my Java app here:
>>>>>>>>>>>>>
>>>>>>>>>>>>>  http://redmine.yellowbkpk.com/projects/list_files/geo
>>>>>>>>>>>>>
>>>>>>>>>>>>> You can use it to convert shapefiles to osm. There is a readme
>>>>>>>>>>>>> included in the zip file.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk-ca/attachments/20090212/75b8983f/attachment.html>


More information about the Talk-ca mailing list