[Talk-ca] Help for Canvec to OSM for part of NB

Frank Steggink steggink at steggink.org
Sun Nov 22 04:18:06 GMT 2009


Hi John,

I must admit that I hardly know anything about setuptools and Python 
eggs. It seems that easy_install (part of setuptools) automatically 
downloads and installs missing dependencies. So, when you install the 
GDAL bindings, it should also install GDAL (of which OGR is a part) for you.

Setuptools can be found here: http://pypi.python.org/pypi/setuptools
Here is an introduction about Python eggs: 
http://mrtopf.de/blog/python_zope/a-small-introduction-to-python-eggs/ . 
A large part deals with creating eggs, so you can skip that.

Good luck,

Frank


JOHN SMART wrote:
> Hi Frank
>
> Yes I'm on Windows. Where I am today:
> - installed GDAL 1.6.1 from
> http://pypi.python.org/packages/2.6/G/GDAL/GDAL-1.6.1.win32-py2.6.exe#md5=5e48c85a9ace1baad77dc26bb42ab4e1
> this download location was referenced by http://pypi.python.org/pypi/GDAL/
>
> In a cmd, window, I set path to include python, and try to run 
> geobase2osm:
>
> C:\OSM>set 
> PATH=C:\OSM\Python26;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Cygwin\Bin;C:\Progr
> am Files\Vim\vim72;C:\Program Files\QuickTime\QTSystem\;C:\Program 
> Files\OpenVPN\bin
>
> C:\OSM>python
> Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit 
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> ^Z
>
> C:\OSM>bin\geobase2osm.py
> C:\OSM\bin\geobase2osm.py:5: DeprecationWarning: the sets module is 
> deprecated
>   import sets
> Traceback (most recent call last):
>   File "C:\OSM\bin\geobase2osm.py", line 10, in <module>
>     import osgeo.ogr
>   File "C:\OSM\Python26\lib\site-packages\osgeo\ogr.py", line 7, in 
> <module>
>     import _ogr
> ImportError: DLL load failed: The specified module could not be found.
>
>
> That line 7 has this:
> import _ogr
>
> Obviously it's trying to import something. Maybe the something is in a 
> python egg GDAL-1.6.1-py2.6-win32.egg 
> <http://pypi.python.org/packages/2.6/G/GDAL/GDAL-1.6.1-py2.6-win32.egg#md5=0d187c3a78279a79a12085ac6ed78711> 
> that's listed on the GDAL python package page. I have no idea what to 
> do with a python egg but maybe it involves finding and installing 
> "setuptools".... or maybe "easy_install" ....
>
> ????
>
> John
>
>
>
>
>
> ------------------------------------------------------------------------
> *From:* Frank Steggink <steggink at steggink.org>
> *To:* JOHN SMART <smartowka at rogers.com>
> *Cc:* talk-ca at openstreetmap.org
> *Sent:* Sat, November 21, 2009 12:23:10 AM
> *Subject:* Re: [Talk-ca] Help for Canvec to OSM for part of NB
>
> Hi John,
>
> It's been a while ago since I installed this. I didn't have GDAL on my 
> machine before, so I'm using the latest version (still 1.6.2). And 
> after the installation I didn't bother about it anymore ;)
>
> Which OS are you using? If you're using Windows, then you should be 
> able to use the installer for the Python version you're using at the 
> bottom of the page. Maybe you also need to install GDAL 1.6.1, if 
> you're currently using an older version, but it might still work if 
> you have an older version. If you're not sure what to choose, you can 
> best try to contact Howard Butler. He is the author of these bindings, 
> and his e-mail address is listed on the page.
>
> If this doesn't work for you, I could make a number of files 
> available, which you can import. A while back I did that also for 
> someone else, which worked well.
>
> By the way, I forgot to add in my first mail that when you're using 
> the Geobase files, you'll have the same attributes which are used in 
> most of the country. This won't be the case for Canvec.
>
> Hope this helps,
>
> Frank
>
> JOHN SMART wrote:
> > Hi Frank
> >
> > Thanks for your reply. I'll use the NRN data for now then. I have 
> grabbed the NB NRN files, no problem there.
> >
> > What I have done so far and where I am stuck now:
> > -- following what's written in 
> http://wiki.openstreetmap.org/wiki/Geobase2osm:
> > - installed python 2.6 (I already had python 2.something as part of 
> FWTools but python version is too early to support Shapely)
> > - installed Shapely 1.0.14 under the Python directory tree
> >
> > but now I am stuck at installing "OGR Python bindings osgeo.ogr 
> Python GDAL" <http://pypi.python.org/pypi/GDAL/>
> > Question: what, exactly, do I need to download and install here.
> > Note that I already have the FWTools (http://fwtools.maptools.org) 
> installation which includes GDAL and OGR.
> > What more / different do I need, to satisfy this Python bindings 
> requirement?
> >
> > Am I still on the right track?
> >
> > Thanks for any more help
> > John
> >
> >
> > ------------------------------------------------------------------------
> > *From:* Frank Steggink <steggink at steggink.org 
> <mailto:steggink at steggink.org>>
> > *To:* John Smart <smartowka at rogers.com <mailto:smartowka at rogers.com>>
> > *Cc:* talk-ca at openstreetmap.org <mailto:talk-ca at openstreetmap.org>
> > *Sent:* Thu, November 19, 2009 11:33:29 PM
> > *Subject:* Re: [Talk-ca] Help for Canvec to OSM for part of NB
> >
> > Hi John,
> >
> > Thanks for looking at the scripts. Please see below.
> >
> > John Smart wrote:
> > > Hello
> > >
> > > I would like to take a shot at updating the OSM for some of New 
> Brunswick, which presently does not have very much mapping compiled. 
> The plan I think I'd like to follow is:
> > >
> > > 1. Select an NTS 1:50 000 area that has few roads and which has no 
> OSM or minimal OSM.
> > > 2. Run script(s) to generate OSM from the Canvec data set. At this 
> point I am only interested in roads, to prove the process for that.
> > > 3. Upload the OSM.
> > > 4. Have some people (you?) review the data, make comments.
> > > 5. Iterate the process a bit till quality good (or I give up!)
> > > 6. If I'm still here, maybe add some more.
> > >
> > > Any comments on my plan are very welcome, especially helpful tips!
> > > Regarding the road data, Canvec is derived from Geobase NRN, so it 
> might be better to use the latter. The CITS guys here should be able 
> to give a better answer ;) For Geobase NRN there is a different 
> script, named geobase2osm.py [1].With that it is possible to convert 
> certain areas (like a NTS tile) to an OSM file, and then you can use 
> JOSM to import the data. There is a wiki page describing the Geobase 
> process [2], but it still describes the convoluted process involving 
> RoadMatcher.
> >
> > The current process is:
> > * create a bounds file for a certain area for geobase2osm.py
> > * execute geobase2osm.py
> > * download OSM data for this area from JOSM
> > * open the resulting OSM file in JOSM
> > * copy over the features which do not exist
> > -> make sure you connect the new roads to the existing roads in OSM
> > -> depending on the density of the data, it is generally better to 
> work in multiple iterations
> > * upload the data to OSM
> > -> indicate in the description of the changeset that you imported 
> data from Geobase for tile 999x00.
> >
> > Several people on this list have experience with this process, so 
> don't hesitate to ask any questions you might have.
> >
> > For Canvec we're organizing a meeting in a few weeks, in order to 
> get some experience with the import, and to work on the process.
> > > The part I'm currently interested in is #2, generating OSM from 
> Canvec. I saw on the mailing list that there is a python script called 
> canvec_to_osm_features.py, and I have downloaded that. However, I have 
> difficulty running it on my Windows XP box. Specifically:
> > > - I can launch python (which I happen to have on my path)
> > > - But if I just run "C:\Canvec2Osm>python 
> canvec_to_osm_features.py --version" then nothing happens.
> > >
> > > I'd appreciate any comments on exactly what I need to do to get 
> this .py script to work.
> > > The script you should execute is canvec-to-osm.py. :) The other 
> script only contains the list of features which should be imported. I 
> separated it to make it easier to manage. (Unfortunately the second 
> script file contains underscores, but I'll update that soon. Maybe I 
> should just rename it to "features.py", so that it is immediately 
> obvious that this script should not be called directly.)
> > > Lastly (for now) I think that if I get the .py working, I will 
> immediately run into a problem with shp-to-osm. Like the .py readme 
> said, I have made a bin directory and I've put the shp-to-osm in 
> there. Actually I have both:
> > > 2009-11-11  17:37        7,365,493 
> shp-to-osm-0.7.3-jar-with-dependencies.jar
> > > 2009-11-11  17:37        7,365,493 shp-to-osm.jar
> > > in case there is some naming problem. Have I done the right thing?
> > > Ian Dees always uses the longer name when building the jar file, 
> so you only have to keep the first one. You'll learn quickly enough if 
> the jar file can't be found for some reason :)
> >
> > > Thanks for any help. I hope I won't get frustrated and that I'll 
> be able to help the project a bit!
> > Helping us would be wonderful. Especially New Brunswick still has 
> large white areas, so it would be excellent to see that filled up!
> >
> > Cheers,
> >
> > Frank
> >
> > [1] http://wiki.openstreetmap.org/wiki/Geobase2osm
> > [2] http://wiki.openstreetmap.org/wiki/Geobase
> >
> >
>





More information about the Talk-ca mailing list