karimbahgat / PyCRS

Projection creation, and conversion to misc formats
MIT License
98 stars 20 forks source link

fix: loader.from_url(). #4

Closed micahcochran closed 8 years ago

micahcochran commented 8 years ago

Add unittest testpycrs.py using python framework for loader.from_url(). parser.from_unknown_text() returns output. loader.from_url() in Python 3 urllib decodes bytes.

You can download testpycrs.py or do this in Python 2 or 3. Here is the test

In [1]: import pycrs

In [2]: crs = pycrs.loader.from_url('http://spatialreference.org/ref/esri/102630/esriwkt/')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-a113c27d1212> in <module>()
----> 1 crs = pycrs.loader.from_url('http://spatialreference.org/ref/esri/102630/esriwkt/')

/home/micah/prj2/PyCRS/pycrs/loader.py in from_url(url, format)
     42 
     43     # then load
---> 44     crs = func(string)
     45     return crs
     46 

/home/micah/prj2/PyCRS/pycrs/parser.py in from_unknown_text(text, strict)
    739     """
    740 
--> 741     if string.startswith("+"):
    742         from_proj4(string, strict)
    743 

NameError: global name 'string' is not defined

This patch fixes this function.

karimbahgat commented 8 years ago

This is great, thanks!

micahcochran commented 8 years ago

Thank you.