pyproj4 / pyproj Goto Github PK
View Code? Open in Web Editor NEWPython interface to PROJ (cartographic projections and coordinate transformations library)
Home Page: https://pyproj4.github.io/pyproj
License: MIT License
Python interface to PROJ (cartographic projections and coordinate transformations library)
Home Page: https://pyproj4.github.io/pyproj
License: MIT License
proper settings should be for EPSG 31253, 31252, 31251 +towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232
NOT +towgs84=682,-203,480,0,0,0,0
Consider the following code:
xyproj = pyproj.Proj(sproj)
llproj = xyproj.to_latlong()
print(type(xyproj))
print(type(llproj))
ondata, latdata = pyproj.transform(self.xyproj, self.llproj, xdata, ydata)
This used to work. But now, it gives me the following:
<class 'pyproj.Proj'>
<class '_proj.Proj'>
Traceback (most recent call last):
File "plot_grid_outlines.py", line 27, in <module>
grid1.plot(basemap)
File "/Users/rpfische/git/icebin/pylib/icebin.py", line 125, in plot
londata, latdata = pyproj.transform(self.xyproj, self.llproj, xdata, ydata)
File "/Users/rpfische/macports/mpgompi-4.9.3/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyproj/__init__.py", line 494, in transform
raise TypeError("p2 must be a Proj class")
TypeError: p2 must be a Proj class
Why is llproj not of the same type as xyproj? And why is transform() now giving an error?
Thanks,
-- Elizabeth
I know this isn't StackOverflow but just wanted to make sure I wasn't missing something obvious that I didn't see while reading through the source.
I have a PROJCS string that looks like this:
'PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["Latitude_Of_Origin",40.16666666666666],UNIT["Foot_US",0.3048006096012192]]'
I've seen other projection libraries (such as proj4 for node) handle this, and so I was wondering if pyproj.Proj()
could as well? Trying to construct it from that raw string gives me this error:
RuntimeError: b'projection not named'
Sorry for the support question. I don't know much about GIS systems...pyproj.Proj()
has worked just fine for me doing this:
pyproj.Proj(init="EPSG:4269")
and:
pyproj.Proj("""
+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74
+x_0=984249.9999999999
+y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs""")
And so reading from PROJCS
type strings (or is it referred to as WKT format?) seems like one more translation. But I don't know much about GIS beyond knowing that I'm trying to convert between two systems, so I apologize if I'm asking about something ridiculously apples-to-oranges.
Using pip install pyproj
throws error
Command
"python setup.py egg_info" failed with error code 1 in C:\Users\admin\Ap
pData\Local\Temp\pip-build-zjrc0gdr\pyproj
conda install pyproj
throws but after saying complete install. I believe this install doesn't work though.
Hint: the following packages conflict with each other:
- pyproj
- python 3.5*
Use conda info pyproj etc. to see the dependencies for each package.
Note that the following features are enabled:
- vc14
Hi,
First of all thank you for this lib :)
Would it be possible to add more epsg codes? Or at least give a good source for those codes and how to add them with the right transformation parameters in the "epsg" file.
Regards
I have a patch for basemap that makes pyproj (and pyshp) external dependencies. Two of the tests fail on Python 3.x with pyproj 1.9.4 (or 1.9.3), but those failing tests work in the development version (details). @jswhit in the short term, could you please merge the import sys PR #32 ?
It might be nice to eventually have a new release, 1.9.5?
I'm working with nose2 in order to try to get a little more functionality out of testing.
What I am specifically looking for:
@params
syntax of nose2.Pytest would not be out of the question. However, It seems like unittest2 (which is unittest in Python 2.7+) has incorporated some of the features that made pytest and nose essential.
Are there other considerations that I'm missing?
i have installed Visual Studio COmmunity, but still get this error, may any help?
C:\Users\Manuel\Desktop>pip install pyproj-1.9.5.1.tar.gz
Processing c:\users\manuel\desktop\pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
using bundled proj4..
Traceback (most recent call last):
File "", line 1, in
File "c:\users\manuel\appdata\local\temp\pip-m2wkql-build\setup.py", line 72, in
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "c:\python27\lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "c:\python27\lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "c:\python27\lib\site-packages\setuptools\msvc.py", line 172, in msvc9_query_vcvarsall
return EnvironmentInfo(arch, ver).return_env()
File "c:\python27\lib\site-packages\setuptools\msvc.py", line 1102, in return_env
[self.VCIncludes,
File "c:\python27\lib\site-packages\setuptools\msvc.py", line 810, in VCIncludes
return [os.path.join(self.si.VCInstallDir, 'Include'),
File "c:\python27\lib\site-packages\setuptools\msvc.py", line 540, in VCInstallDir
python_vc = self.ri.lookup(reg_path, 'installdir')
File "c:\python27\lib\site-packages\setuptools\msvc.py", line 450, in lookup
bkey = winreg.OpenKey(hkey, key, 0, winreg.KEY_READ)
WindowsError: [Error 2] Das System kann die angegebene Datei nicht finden
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\manuel\appdata\local\temp\pip-m2wkql-build\
C:\Users\Manuel\Desktop>
When I converting coordinates from:
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
to:
+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs
projection I got this wit pyproj:
1.4405084639 103.8377068722 15.271
inf, inf, 15.271
1.3678260389 103.8449220306 23.822
inf, inf, 23.822
Checking with cs2cs command:
cs2cs +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +to +proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs -r
provides the right data:
1.4405084639 103.8377068722 15.271
-1524999.86 6191095.61 159267.12
1.3678260389 103.8449220306 23.822
-1525828.66 6191103.04 151232.86
Do you have idea what causes this problem? I tried with Pyproj 1.9.4 (master) that I downloaded today (5c18eef).
It appears that the Microsoft Compiler for Python 2.7
doesn't like the warning pragma and raises a fatal error while compiling when trying to install using pip.
C:\Users\ishare\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc -IC:\Python27\include -IC:\Python27\PC /Tcsrc\pj_strtod.c /Fobuild\temp.win32-2.7\Release\src\pj_strtod.obj
pj_strtod.c
src\pj_strtod.c(79) : fatal error C1021: invalid preprocessor command 'warning'
error: command 'C:\\Users\\ishare\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
I have locally commented out the offending line, and then successfully installed it using pip.
Hi,
I try to create WGS84 to EOV converter. First I wanted to create an app that generate WGS grid coordinates to EOV coordinates.
EOV: http://spatialreference.org/ref/epsg/hd72-eov/
My code is here:
https://github.com/KAMI911/wgslas2eovlas/blob/master/gridcreator.py
I used python-pyproj 1.8.9-1.1build2 packaged into Ubuntu/Linux Mint on 64 bit.
After I created file with EOV coordinates I tried to convert them back (and failed) to WGS with this tool:
http://pf-prg.hu/trafo/trafo-4.php?mod=0
Do you have idea what did i wrong? Or is this a bug in the software?
The output files are here:
http://ooo.itc.hu/wgseov/
Thank you in advance!
Hi,
I just tried to build pyproj for Fedora Rawhide, using the brand new proj-4.9.1 release and switched on the tests defined in pyproj/init.py.
I noticed that a fair number of them fail with this new proj version. Out of 73 tests the overall score was 54 passed and 19 failed (and it does not depend on the architecture used by the build.
Could you please take a look and let me know if this indicates real problems, or if this can be safely ignored for now?
The testresults are in these logfiles:
https://kojipkgs.fedoraproject.org//work/tasks/889/9210889/build.log
https://kojipkgs.fedoraproject.org//work/tasks/888/9210888/build.log
https://kojipkgs.fedoraproject.org//work/tasks/887/9210887/build.log
pip install /Users/Shahar/Downloads/pyproj-master.zip
Processing ./Downloads/pyproj-master.zip
Complete output from command python setup.py egg_info:
nad2bin.c:2:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/var/folders/cp/d0fykvdx687ctsrklvnl4m6w0000gn/T/pip-Ey6WOM-build/setup.py", line 16, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "/Applications/Canopy.app/appdata/canopy-1.5.1.2730.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/Applications/Canopy.app/appdata/canopy-1.5.1.2730.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
raise CompileError, msg
distutils.errors.CompileError: command 'gcc' failed with exit status 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /var/folders/cp/d0fykvdx687ctsrklvnl4m6w0000gn/T/pip-Ey6WOM-build
We unfortunately have some code which depends on 1.9.3 (needs to be fixed, obviously), and it took me a while to work out which commit this was. I think it's f036fae, but I'm not completely sure.
I guess all these got lost when it moved from ?google code?, but if it was easy to tag them that would be cool.
I installed pyproj on a Linux machine. I do not get any errors while installing pyproj using pip3.
But, while importing pyproj. I get errors _proj.cpython-34m.so: undefined symbol: __intel_sse2_strcpy.
My linux enviroment:
Linux raijin1 2.6.32-573.22.1.el6.x86_64 #1 SMP Wed Mar 23 03:35:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
My python virtual environment has numpy 1.11.0 and cython 0.24.
(v1) [yxs659@raijin1 tests]$ pip3 list
cycler (0.10.0)
Cython (0.24)
matplotlib (1.5.1)
numpy (1.11.0)
pip (8.1.1)
pyparsing (2.1.1)
pyproj (1.9.5.1)
python-dateutil (2.5.3)
pytz (2016.4)
rHEALPixDGGS (0.5.1)
scipy (0.17.0)
setuptools (20.10.1)
six (1.10.0)
wheel (0.29.0)
The error I get is the following,
(v1) [yxs659@raijin1 tests]$ python3
Python 3.4.3 (default, Jul 15 2015, 12:53:20)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyproj
Traceback (most recent call last):
File "", line 1, in
File "/home/659/yxs659/virt_env/v1/lib/python3.4/site-packages/pyproj/init.py", line 51, in
from pyproj import _proj
ImportError: /home/659/yxs659/virt_env/v1/lib/python3.4/site-packages/pyproj/_proj.cpython-34m.so: undefined symbol: __intel_sse2_strcpy
Hello,
I am trying to convert a script I wrote in Perl years ago to Python, and while I believe I've followed the directions, the results do not match up with what I'd expect.
Code:
from pyproj import Proj
nc = Proj(init='epsg:3359') # I've tried most of the available NC options (site below)
y = [2110926.0]
x = [0738252.0]
lon, lat = nc(x, y, inverse=True)
print lon, lat
[-77.19861281130545] [52.46179322191929]
This address should return as -78.7122, 35.7684 or thereabouts.
Am I missing some step? I've also tried entering all of the parameters individually with the same results.
http://spatialreference.org/ref/?search=carolina
Thanks
Missing import sys
in lib/pyproj/__init__.py
since pull request #30
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-c6ec65490265> in <module>()
----> 1 import pyproj
/home/me/.local/lib/python2.7/site-packages/pyproj-1.9.4-py2.7-linux-x86_64.egg/pyproj/__init__.py in <module>()
57
58 # Python 2/3 compatibility
---> 59 if sys.version_info[0] == 2: # Python 2
60 string_types = (basestring,)
61 else: # Python 3
NameError: name 'sys' is not defined
Hi!
I tried to install it with pip install... and with the setup.py. I installed the vc++ package, but after that, i get this error: _proj.c(240) : fatal error C1083: Cannot open include file: 'geodesic.h': No such file or directory
I found GeographicLib-1.46, but i have no idea how to install it. Can you please help me with that?
In moving from 1.8.9 to 1.9.5.1 I've noticed that Geod no longer performs calculations in radians correctly.
The following prints different numbers for the two calculations in Python 3.4.3:
import math
from pyproj import Geod
g = Geod(ellps='clrk66') # Use Clarke 1966 ellipsoid.
# specify the lat/lons of some cities.
boston_lat = 42. + (15. / 60.)
boston_lon = -71. - (7. / 60.)
portland_lat = 45. + (31. / 60.)
portland_lon = -123. - (41. / 60.)
# compute forward and back azimuths, plus distance between Boston and Portland.
# First in degrees
az12_d, az21_d, dist_d = g.inv(
boston_lon,
boston_lat,
portland_lon,
portland_lat,
radians=False)
# Now in radians
az12_r, az21_r, dist_r = g.inv(
math.radians(boston_lon),
math.radians(boston_lat),
math.radians(portland_lon),
math.radians(portland_lat),
radians=True)
print(az12_d, az21_d, dist_d)
print(math.degrees(az12_r), math.degrees(az21_r), dist_r)
The same occurs for g.fwd() and g.npts().
Regards,
Chris.
Could the pyproj library be used within Ironpython? and are there any additional supporting materials required to do so?
I wasn't able to configure pyproj with ECLIPSE. However, I was able to do it with standalone Py IDE.
Did any one try? What do I have to do it to properly run it in Eclipse.
I did properly add the source folders & eggs in pythonpath. I always get this error:
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
Traceback (most recent call last):
File "X:\Eclipse_Java_Workspace\CoordConv\src\subset.py", line 11, in
from pyproj import Proj, transform
File "C:\Python27\Lib\site-packages\pyproj-1.9.5.1-py2.7-win32.egg\pyproj__init__.py", line 51, in
from pyproj import _proj
File "C:\Python27\Lib\site-packages\pyproj-1.9.5.1-py2.7-win32.egg\pyproj_proj.py", line 7, in
bootstrap()
File "C:\Python27\Lib\site-packages\pyproj-1.9.5.1-py2.7-win32.egg\pyproj_proj.py", line 6, in bootstrap
imp.load_dynamic(name,file)
ImportError: No module named pyproj._proj
How comes that you use the __new__
method with self
, even though it is a static method by definition?
https://github.com/jswhit/pyproj/blob/master/lib/pyproj/__init__.py#L608
I have problems with the latest version of pyproj:
>>> import pyproj
>>> pyproj.__version__
'1.9.4'
>>> pyproj.Proj('+init=epsg:4326 +no_defs=True')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\envs\test_pyproj3\lib\site-packages\pyproj\__init__.py", lin
e 347, in __new__
return _proj.Proj.__new__(self, projstring)
File "_proj.pyx", line 84, in _proj.Proj.__cinit__ (_proj.c:1190)
RuntimeError: b'Invalid argument'
I am on Windows and installed pyproj
using conda. I was wondering if this was an error in the conda package, but I tried several different packages (the default channel + ioos and JimInCO channels), but got the same error for all.
When downgrading to 1.9.3 (available in the JimInCO channel for win64), the error was gone.
The above was with python 3.4. On python 2.7, I see the same error with the default package of 1.9.4 (but it works for 1.9.2), and here, the ioos package of 1.9.4 also works.
I'm attempting to use an existing install of proj.4 (libproj-dev) on Ubuntu 16.04 as the c library source for pyproj, but I'm having trouble determining the path that I need to set the PROJ_DIR
environment variable to. For my proj.4 install the folder that has the files 'espg', 'esri', 'nad27', etc. is /usr/share/proj
and I've set the environment variable to that path and then run:
pip install -vvv pyproj
the build succeeds, but based on the output that is generated I'm not sure that it's using my proj.4 install as it doesn't name the paths where library's files are located. Is there a way to check the proj.4 that pyproj is using? I've also tried setting PROJ_DIR
to /lib/
as the README suggests, and the build succeeds then as well, but in that case it seems even less likely that it would be using the previously installed proj.4 as none of the files are stored under /lib
rather they're all under /usr
. Here's the output from pip when PROJ_DIR
is set to /usr/share/proj
:
Collecting pyproj
1 location(s) to search for versions of pyproj:
* https://pypi.python.org/simple/pyproj/
Getting page https://pypi.python.org/simple/pyproj/
Looking up "https://pypi.python.org/simple/pyproj/" in the cache
No cache entry available
Starting new HTTPS connection (1): pypi.python.org
"GET /simple/pyproj/ HTTP/1.1" 200 666
Updating cache with response from "https://pypi.python.org/simple/pyproj/"
Caching b/c date exists and max-age > 0
Analyzing links from page https://pypi.python.org/simple/pyproj/
Found link https://pypi.python.org/packages/0d/db/5fa6fe77a2f04c8b7ffb9d1661587114145324199dd273e2d7079655cf77/pyproj-1.8.1.tar.gz#md5=1b28a593e5868e314cd07f4d291ab1a3 (from https://pypi.python.org/simple/pyproj/), version: 1.8.1
Found link https://pypi.python.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz#md5=027345e3c033fa400e0e64a1c80d34c9 (from https://pypi.python.org/simple/pyproj/), version: 1.9.5.1
Found link https://pypi.python.org/packages/3f/9c/bb7cbce5d5453066d63750399e6a74ef8a5e2d2d89c02e6d0ac7ce0ea8fe/pyproj-1.8.1a.tar.gz#md5=389fa3457d5332d54ff209afcea7ca4f (from https://pypi.python.org/simple/pyproj/), version: 1.8.1a
Found link https://pypi.python.org/packages/50/a6/87d081407287534106a38033daf8c00763a99f054bb3015423515e480e95/pyproj-1.9.4.tar.gz#md5=b0a060465b117dd6c1b37e14f22382aa (from https://pypi.python.org/simple/pyproj/), version: 1.9.4
Found link https://pypi.python.org/packages/cd/4e/0bcb33a08ba07f483dfcb8ffc58c02bb2883d14dc81d9da8c4da02efc1b5/pyproj-1.8.0.tar.gz#md5=d4aff8a45639ac64ebfc4d84ad72a869 (from https://pypi.python.org/simple/pyproj/), version: 1.8.0
Found link https://pypi.python.org/packages/e5/d5/bdbe10850da198238cb693019993827e920421eca5d662166f84f3928db6/pyproj-1.9.5.tar.gz#md5=3446a23f1c9de4827b31996ff213c5a3 (from https://pypi.python.org/simple/pyproj/), version: 1.9.5
Found link https://pypi.python.org/packages/f9/7f/ee337f570e4c3ef4593709dcb63e813c359184ede249c4f79b761186bd08/pyproj-1.9.3.tar.gz#md5=ad0ac0602b6373c4203b4d0774445694 (from https://pypi.python.org/simple/pyproj/), version: 1.9.3
Using version 1.9.5.1 (newest of versions: 1.8.0, 1.8.1, 1.9.3, 1.9.4, 1.9.5, 1.9.5.1)
Looking up "https://pypi.python.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz" in the cache
No cache entry available
"GET /packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz HTTP/1.1" 200 4424543
Downloading pyproj-1.9.5.1.tar.gz (4.4MB)
Downloading from URL https://pypi.python.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz#md5=027345e3c033fa400e0e64a1c80d34c9 (from https://pypi.python.org/simple/pyproj/)
99% |████████████████████████████████| 4.4MB 8.5MB/s eta 0:00:01 Updating cache with response from "https://pypi.python.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz"
Caching due to etag
100% |████████████████████████████████| 4.4MB 294kB/s
Running setup.py (path:/tmp/pip-build-hwoOXH/pyproj/setup.py) egg_info for package pyproj
Running command python setup.py egg_info
PROJ_DIR is set, using existing proj4 installation..
running egg_info
creating pip-egg-info/pyproj.egg-info
writing pip-egg-info/pyproj.egg-info/PKG-INFO
writing top-level names to pip-egg-info/pyproj.egg-info/top_level.txt
writing dependency_links to pip-egg-info/pyproj.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/pyproj.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/pyproj.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'src/*diff'
writing manifest file 'pip-egg-info/pyproj.egg-info/SOURCES.txt'
Source in /tmp/pip-build-hwoOXH/pyproj has version 1.9.5.1, which satisfies requirement pyproj from https://pypi.python.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz#md5=027345e3c033fa400e0e64a1c80d34c9
Building wheels for collected packages: pyproj
Running setup.py bdist_wheel for pyproj ... Destination directory: /tmp/tmpa4xXCApip-wheel-
Running command /home/ubuntu/venv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-hwoOXH/pyproj/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpa4xXCApip-wheel- --python-tag cp27
PROJ_DIR is set, using existing proj4 installation..
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pyproj
copying lib/pyproj/datadir.py -> build/lib.linux-x86_64-2.7/pyproj
copying lib/pyproj/__init__.py -> build/lib.linux-x86_64-2.7/pyproj
running build_ext
building 'pyproj._proj' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/share/proj/include -I/usr/include/python2.7 -c _proj.c -o build/temp.linux-x86_64-2.7/_proj.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/_proj.o -L/usr/share/proj/lib -L/usr/share/proj/lib64 -Wl,-R/usr/share/proj/lib -Wl,-R/usr/share/proj/lib64 -lproj -o build/lib.linux-x86_64-2.7/pyproj/_proj.so
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/pyproj
copying build/lib.linux-x86_64-2.7/pyproj/datadir.py -> build/bdist.linux-x86_64/wheel/pyproj
copying build/lib.linux-x86_64-2.7/pyproj/_proj.so -> build/bdist.linux-x86_64/wheel/pyproj
copying build/lib.linux-x86_64-2.7/pyproj/__init__.py -> build/bdist.linux-x86_64/wheel/pyproj
running install_egg_info
running egg_info
writing lib/pyproj.egg-info/PKG-INFO
writing top-level names to lib/pyproj.egg-info/top_level.txt
writing dependency_links to lib/pyproj.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'lib/pyproj.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'src/*diff'
writing manifest file 'lib/pyproj.egg-info/SOURCES.txt'
Copying lib/pyproj.egg-info to build/bdist.linux-x86_64/wheel/pyproj-1.9.5.1-py2.7.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/pyproj-1.9.5.1.dist-info/WHEEL
done
Stored in directory: /home/ubuntu/.cache/pip/wheels/85/dd/2f/d1ed07a507c7adb330cda0afcc96cae8e9abb4d85bbb788bdf
Removing source in /tmp/pip-build-hwoOXH/pyproj
Successfully built pyproj
Installing collected packages: pyproj
Successfully installed pyproj-1.9.5.1
pyproj doesn't seem to check if projections are equal when asked to transform:
x = np.random.randn(1e7) * 60
y = np.random.randn(1e7) * 60
start_time = time.time()
xx, yy = pyproj.transform(pyproj.Proj(init='epsg:26915'), pyproj.Proj(init='epsg:26915'), x, y)
print(end_time-time.time())
Takes about 3 seconds on my laptop. I wonder if it would be possible for pyproj to catch these?
Would the following workaround work or is it dangerous?
def my_transform(p1, p2, x, y):
if p1.srs == p2.srs:
return x.copy(), y.copy() # or no copy if kwd nocopy=True
return pyproj.transform(p1, p2, x, y)
Thanks,
Fabien
The docstring of Proj.__call__
states that it would be possible to pass an ndarray
of shape (n,2)
, but the supporting code is commented out in __call__
as well as the cython defined methods of _invn
and _fwdn
.
What is the problem with these? It would help a lot if they were supported again.
Curious: is there a way to get back a proj4 string from a Proj object? Preferably an informative one?
For example, if I passed:
p = pyproj.Proj('+init=epsg:4326')
is there a way I could get back "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
through something like a method on p
?
Why does
pyproj.Proj( "+init=epsg:%d" % ( theEPSG ) ),
work, while
theInitString = "epsg:%d" % ( theEPSG ) pyproj.Proj( init=theInitString )
fails ? I see an error saying the data for proj cannot be found with the latter form. I'm running on Ubuntu 14.04
Hi there, I have very little experience with python or anything similar.
I have a .gz file from https://pypi.python.org/pypi/pyproj?, which I extracted using 7zip then opened cmd (Windows) with Administrator privileges and entered
cd C:\Users\username\Desktop\pyproj-1.9.4
setup.py install
I don't get it, in step by step instructions how do I install this to a functioning state?
I was working on adding an eq operator (using the repr function in PR #63) for Geod, and found a shared memory bug.
For example (this is without the repr PR patch applied):
In [1]: from pyproj import Geod, pj_ellps
In [2]: pj_ellps['lerch']
Out[2]: {'a': 6378139.0, 'description': 'Lerch 1979', 'rf': 298.257}
In [3]: pj_ellps['clrk66']
Out[3]: {'a': 6378206.4, 'b': 6356583.8, 'description': 'Clarke 1866'}
# these ellipsoids are not equal
In [4]: pj_ellps['lerch']['a'] == pj_ellps['clrk66']['a']
Out[4]: False
In [5]: glerch = Geod(ellps='lerch')
In [6]: glerch.a
Out[6]: 6378139.0
In [7]: ga = glerch.a # store this
In [8]: repr(glerch)
Out[8]: '<pyproj.Geod object at 0x0208E090>'
In [9]: gclrk = Geod(ellps='clrk66')
In [10]: gclrk.a
Out[10]: 6378206.4
In [11]: repr(gclrk)
Out[11]: '<pyproj.Geod object at 0x0208E258>'
In [12]: ga == glerch.a # compare those from #7, these should match
Out[12]: False
In [13]: glerch.a
Out[13]: 6378206.4 # this should be 6378139.0
In [14]: repr(glerch)
Out[14]: '<pyproj.Geod object at 0x0208E090>'
In [15]: repr(gclrk)
Out[15]: '<pyproj.Geod object at 0x0208E258>'
In [16]: glerch.a == gclrk.a # should not match, see #4
Out[16]: True
The .initstring
variable is unaffected by this.
There is some memory sharing happening in the Geod class between different instances.
One way to resolve this is just documenting that there can only be one Geod object. I think it is preferable to rewriting this to allow for multiple Geod objects that do not share memory.
I tested pyproj version 1.9.5.1 and 1.9.3, both have the problem. I'm planning to do a little more investigation.
Since Proj.4 is now being managed on GitHub as of 2015-05-27, should pyproj/src be setup to be a fork of proj.4/src?
Would this help the project's management slightly?
My understanding of git and GitHub are quite limited, so there are could be very good reasons not to do that.
I encountered an issue for the case when the pyproj module is build without the bundled proj sources. In this case the test run: python -c 'import pyproj;pyproj.test()'
ends with an ugly segmentation fault.
After some digging around I found that this is caused by the fact that my system (Fedora 23) has proj version 4.9.1 which does not have the inverse function for the hammer projection available. The same happens on Fedora rawhide(24) which has proj version 4.9.2
The segmentation fault happens at the call:
projlonlatout = pj_inv(projxyin,self.projpj)
on line 204 of the file _proj.pyx
The root cause is the fact that the inverse function is called through a pointer in the self.projpj object, and the cython code does not check if this function pointer is defined or not (actually I don't even know if this is possible inside cython, maybe a little additional c-code is needed to do this).
Anyway, it would be nice if some safety check coul;d be added to pyproj to let it safely run for older external proj versions. Of course the problem will go away when proj 4.9.3 is released, as mentioned in issue #19 but I have no idea when that will happen.
I'm trying to test roundtrip (roundtrip is p1->p2->p1) stability in my projections and found a curious case (a bug?) when trying to convert from WGS84 to NAD27 and back.
We can see the values here:
>>> from pyproj import Proj, transform
>>> wgs84_proj = Proj('+proj=longlat +datum=WGS84 +no_defs')
>>> nad27_proj = Proj('+proj=longlat +datum=NAD27 +no_defs')
>>> wgs84_pos = (-128.0, 50.98)
>>> nad27_pos = transform(wgs84_proj, nad27_proj, wgs84_pos[0], wgs84_pos[1])
>>> nad27_pos
(-127.99845565740134, 50.98025249402805)
>>> wgs84_pos_roundtrip = transform(nad27_proj, wgs84_proj, nad27_pos[0], nad27_pos[1])
>>> wgs84_pos_roundtrip
(-128.00005191895045, 50.98006355013494)
And they are almost 8 meters apart:
>>> from pyproj import Geod
>>> wgs84_geod = Geod(ellps='WGS84')
>>> angle1, angle2, distance = wgs84_geod.inv(wgs84_pos[0], wgs84_pos[1], wgs84_pos_roundtrip[0], wgs84_pos_roundtrip[1])
>>> distance
7.954669999055905
I have tested several positions and I only seem to have problems with longitude at -128.0
and latitudes between 50.98
and 76.98
.
For example:
>>> wgs84_pos = (-127.9, 50.98)
>>> nad27_pos = transform(wgs84_proj, nad27_proj, wgs84_pos[0], wgs84_pos[1])
>>> wgs84_pos_roundtrip = transform(nad27_proj, wgs84_proj, nad27_pos[0], nad27_pos[1])
>>> nad27_pos
(-127.89840687790532, 50.98018566035921)
>>> wgs84_pos_roundtrip
(-127.9, 50.98000000000001)
>>> angle1, angle2, distance = wgs84_geod.inv(wgs84_pos[0], wgs84_pos[1], wgs84_pos_roundtrip[0], wgs84_pos_roundtrip[1])
>>> distance
7.069288649822944e-10
Which seems to be just fine!
I also tested this with ArcGis API and it seems to work fine.
Any thoughts? I ran the following:
clone github repo or download source release at http://python.org/pypi/pyproj.
python setup.py build
python setup.py install (with sudo if necessary).
To test, run python -c "import pyproj; pyproj.test()"
Thanks!
With PyProj:
import pyproj
wgs84 = pyproj.Proj("+init=EPSG:4326")
ny_state = pyproj.Proj("+init=EPSG:2263")
pyproj.transform(wgs84, ny_state, -74.01720548026697, 40.641305906460005)
Result: (298544.59235271334, 52706.69470216743)
Compare to gdaltransform
:
$ gdaltransform -s_srs EPSG:4326 -t_srs EPSG:2263
-74.01720548026697, 40.641305906460005
979475.050077194 172921.880868694 0
By contrast, PyProj and GDAL agree when transforming to WebMercator:
webmerc = pyproj.Proj("+init=EPSG:3857")
pyproj.transform(wgs84, webmerc, -74.01720548026697, 40.641305906460005)
Result: (-8239557.624004417, 4959577.466271832)
gdaltransform -s_srs EPSG:4326 -t_srs EPSG:3857
-74.01720548026697, 40.641305906460005
-8239557.62400442 4959577.46627184 0
Hello
I can't manage to install pyproj on Winpython (currently using WinPython-32bit-2.7.10.3 on a Win7 Pro environment). Winpython does use a "control panel" for installations. I have no warning/error messages, but when the installation seems to be complete, but the process seems to fail anyway.
I have tryed those files so far :
I also tryed with two whl files coming from the Unofficial Windows Binaries for Python Extension Packages but I've had an error on installation ('The followin packages filenaming are not recognized by WinPython Control Panel: pyproj--1.9.5.1.-cp27-cp27m-win32.whl')
Any clue about it ?
Thanks
tgrandje
I have a situation where I want to take geographic features and use these as an input for numerical modelling. The modelling is cartesian, so I need to project the coordinates. At the same time, it is often useful to apply a rotation of the coordinate system, as it can help to make more natural model boundary conditions.
Is there any way I can add a rotation to a projection, so that I can call my point transformation (rotation/projection) in a single step?
Thanks
Dan
(Problem reposted from matplotlib forum)
I am trying to calculate the azimuth orientation of vectors in a general coordinate system, defined by a proj4 string.
My approach is to calculate the azimuth angle of the y-axis of the given projection, and add this to the angle relative to the given coordinate system.
The illustration code below uses pyproj.Geod to calculate azimuth angle along the projection y-axis, but the output (bottom) does not make sense; the azimuth angle is found to be nearly the same for points at very different latitudes. This is the same for other projections such as e.g.:
proj4 = '+proj=lcc +lon_0=15 +lat_0=63 +lat_1=63 +lat_2=63 +R=6.371e+06 +units=m +no_defs'
However, using simply proj4 = '+proj=stere', I get results as expected. But as soon as I add '+lat_0' to the proj4-string, output is clearly wrong.
Is this a bug in (py)proj?
import numpy as np
from mpl_toolkits.basemap import pyproj
proj4 = '+proj=stere +lat_0=90 +lon_0=70 +lat_ts=60 +units=m +a=6.371e+06 +e=0 +no_defs'
p = pyproj.Proj(proj4)
# Create three points for testing
lon_1 = np.array([30., 30., 30.])
lat_1 = np.array([60., 80., 89.])
x_1, y_1 = p(lon_1, lat_1) # Calculate projection (x,y) coordinates
lon_2, lat_2 = p(x_1, y_1 + 1000.0, inverse=True, errchk=True) # Find (lon,lat) of a point 1000 m away along y-axis
# Calculate azimuth from p1 to p2 (i.e. along projection y-axis)
g = pyproj.Geod(ellps='WGS84')
az = g.inv(lon_1, lat_1, lon_2, lat_2, radians=False)
# Output: [-40.04826805 -40.00599836 -40.00008458] - does not make sense
print az[0]
I execute the following code lines in the Qgis python shell, then qgis crashes. When i execute the code outside of Qgis everthing works perfekt.
from pyproj import Proj, transform
in_projection = Proj(init="epsg:3857")
out_projection = Proj(init="epsg:4326")
lat, lng = transform(in_projection, out_projection, 887590, 7210569)
The enviroment:
OS: Ubuntu 14.04 LTS
Qgis: 2.6.1-Brighton
Project cbs: WGS 84 / Pseudo Mercator (EPSG:3857)
PROJ.4-Version: 480
Qt: 4.8.6
Python: 2.7.6
pyproj: 1.9.4
$ python setup.py build
nad2bin.c
nad2bin.c(129) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
nad2bin.c(130) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
nad2bin.c(137) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
nad2bin.c(138) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
nad2bin.c(352) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
nad2bin.c(353) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
pj_malloc.c
using bundled proj4..
Traceback (most recent call last):
File "setup.py", line 84, in
cc.link_executable(objects, execname, extra_postargs = [ '/MANIFEST' ] if os.name == 'nt' else None)
File "C:\Python27\lib\distutils\ccompiler.py", line 700, in link_executable
debug, extra_preargs, extra_postargs, None, target_lang)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 669, in link
raise LinkError(msg)
distutils.errors.LinkError: command 'C:\Users\shane\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin\x64\mt.exe' failed with exit status 31
Phyton 2.7
Visual C 2.7
Hey,
I cannot import pyproj in my Python 3.5.1 virtualenv on the mac.
$ python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyproj
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/besn/Dropbox/metascapes-ivs/Projects/2016-ebikes-gothenborg/elcykler-göteborg-2016/ebike-json-loader/lib/python3.5/site-packages/pyproj/__init__.py", line 251, in <module>
set_datapath(pyproj_datadir)
File "_proj.pyx", line 59, in _proj.set_datapath (_proj.c:887)
File "_proj.pyx", line 370, in _proj._strencode (_proj.c:3939)
UnicodeEncodeError: 'ascii' codec can't encode character '\u0308' in position 78: ordinal not in range(128)
pyproj.transform results in a segementation fault if the second parameter isn't a Proj instance. (If the first argument is invalid, it raises an AttributeError, which is a much better behavior).
This is on OS X Yosemite.
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyproj
>>> p = pyproj.Proj(init='epsg:4269')
>>> pyproj.transform(None, p, -74, 39)
...
AttributeError: 'NoneType' object has no attribute 'is_latlong'
>>> pyproj.transform(p, None, -74, 39)
Segmentation fault: 11
I'd be happy to provide more info, but I don't know where to look on OS X.
Typically, release tarballs are named as "name-version.tar.gz" and unpack to "name-version". However, the release tarball is named "v1.9.4rel.tar.tgz". This doesn't even have "pyproj" in it. On unpacking, one gets pyproj-1.9.4rel, which isn't v1.9.4rel, and includes "rel" which presumably is not really part of the release number.
Coping with this required the following in the pkgsrc control file:
VERSION= 1.9.4
PKGNAMEBASE= pyproj
DISTNAME= v${VERSION}rel
DIST_SUBDIR= pyproj
EGG_NAME= ${PKGNAMEBASE}-${VERSION}
PKGNAME= ${PYPKGPREFIX}-${PKGNAMEBASE:S/pyproj/proj/}-${VERSION}
MASTER_SITES= https://github.com/jswhit/pyproj/archive/
WRKSRC= ${WRKDIR}/${PKGNAMEBASE}-${VERSION}rel
compared to the previous
DISTNAME= pyproj-1.9.3
PKGNAME= ${PYPKGPREFIX}-${DISTNAME:S/pyproj/proj/}
MASTER_SITES= http://pyproj.googlecode.com/files/
This isn't about pkgsrc, really - I would expect most other packaging systems to key off the name and derive many things automatically. (We do rename pyproj-1.2.3 to py27-proj.1.2.3, when built for python 2.7, since multiple python versions are supported.)
Phrased as specific requests rather than complaints:
I realize github makes it difficult to use anything other than git directly.
Thanks,
Greg
I've installed PyProj using the wheel from here - http://www.lfd.uci.edu/~gohlke/pythonlibs/ using pip, as I don't want to install a 3GB Visual Studio "runtime" to compile it myself.
I'm using Windows with Python 3.5 (x64).
However, when I try and run my transformation, I get this exception:
Traceback (most recent call last):
File "E:/X_Dev/ogc__xml_to_es/src/xml_to_es.py", line 196, in <module>
process_specified_project(args.index_name, args.proj_to_process)
File "E:/X_Dev/ogc__xml_to_es/src/xml_to_es.py", line 183, in process_specified_project
process_a_project(es, proj_to_process, PROJ_PATH, index_name)
File "E:/X_Dev/ogc__xml_to_es/src/xml_to_es.py", line 140, in process_a_project
post_processed = post_proc.post_process(parsed_content)
File "E:\X_Dev\ogc__xml_to_es\src\post_process_xml.py", line 29, in post_process
this_layer[key] = bbox_to_envelope(value, this_layer)
File "E:\X_Dev\ogc__xml_to_es\src\post_process_xml.py", line 114, in bbox_to_envelope
coords = change_coords(coords, start_proj, 'EPGS:4326')
File "E:\X_Dev\ogc__xml_to_es\src\post_process_xml.py", line 181, in change_coords
target = pyproj.Proj(init=target_proj)
File "C:\Python35\lib\site-packages\pyproj\__init__.py", line 365, in __new__
return _proj.Proj.__new__(self, projstring)
File "_proj.pyx", line 117, in _proj.Proj.__cinit__ (_proj.c:1281)
RuntimeError: b'no system list, errno: 2\n'
Reading around suggests that this is because pyproj cannot find my /data directory. However it does exist and the pyproj.pyproj_datadir
does have the correct path to it-
'C:\Python35\lib\site-packages\pyproj\data'
The data directory has 40 items totalling just over 5 MB.
I have tried explicitly doing:
pyproj.set_datapath(pyproj.pyproj_datadir)
But it still refuses to run. Am I doing something wrong, or is there something odd going on?
(reading around only found these:
https://sourceforge.net/p/py2exe/bugs/139/
http://stackoverflow.com/questions/20201532/issues-with-pyinstaller-and-pyproj
But neither directly relates to this issue as they're using alternative methods of installation)
Hello,
I have some troubles when I try to buil pyproj :
_proj.c(8): fatal error C1083: Impossible d'ouvrir le fichier include : 'pyconfig.h' : No such file or directory
I am on Windows8 with Python3.5
Can you help me ?
Thanks
SYG
Any definition parameter without an '=' will actually crash the logic on init.py, line 698:
File "/usr/local/lib/python2.7/dist-packages/pyproj/init.py", line 698, in new
k,v = kvpair.split('=')
The definition I used was: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +units=m +nadgrids=@null +no_defs +x_0=5113560.997131 +y_0=2662158.879021
I need to install pyproj-1.9.5.1 module for Python 2.7 on Windows 8. I have used this link (https://github.com/jswhit/pyproj), I found only pyproj-1.9.5.1.tar.gz. How can I install it on my machine please?
According to http://pyproj.googlecode.com/svn/trunk/docs/pyproj.Proj-class.html pyproj takes the latitude and longitude input arguments in the order "lon, lat".
This is not compliant to ISO 6709 (https://en.wikipedia.org/wiki/ISO_6709), which says that the order must always be "lat, lon":
Order, positive direction, and units of coordinates are supposed to be defined by the CRS. When CRS identification is missing, the data must be interpreted by the following conventions:
- Latitude comes before longitude
- North latitude is positive
- East longitude is positive
This causes frequent frequent problems when people are used to do geodetic calculations ISO compliant. Many don't even think about that a library with the importance of pyproj might expect a non-standard compliant argument order.
Of course the argument order can't be just changed because of backwards compatibility reasons. But would it be an possible to introduce an option for using an ISO compliant input parameter order?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.