GDAL, ogr2ogr "Cannot find proj.db" Error - geojson

I've tried to extract certain country from the world shp file from natural earth.
I am currently using windows 10, so I installed python 3.7, gdal to use the ogr2ogr.
I typed the below code in the command to extract the south korea
ogr2ogr -f GeoJSON -where "geonunit='South Korea'" korea-geo.json
ne_10m_admin_1_states_provinces.shp
But the below errors are coming out.
ERROR 1: PROJ: proj_create_from_wkt: Cannot find proj.db
ERROR 1: PROJ: proj_identify: Cannot find proj.db
I already set up the environmental variables for Gdal..
C:\Program Files\GDAL\gdal-data
C:\Program Files\GDAL\gdalplugins
Please guide me to solve this problem.

Check your environment_variable:
setx GDAL_DATA "C:\Program Files\GDAL\gdal-data"
setx GDAL_DRIVER_PATH "C:\Program Files\GDAL\gdalplugins"
setx PROJ_LIB "C:\Program Files\GDAL\projlib"
setx PYTHONPATH "C:\Program Files\GDAL\"

Adding PROJ_DEBUG=3 to your environment_variable is very useful. The error message will then tell you where PROJ is expecting the file.

You might need to set the PROJ_LIB environment variable. But I'm not sure where that data lives on your system. It could also be affected by how you installed GDAL.
If you go into your C:\Program Files\GDAL directory, do you have a folder called proj? If so, see if it has proj.db file in it. If it does, that's your PROJ_LIB path value. You might also find it in some kind of share folder.
If you don't find it nested somewhere in your GDAL directory, try searching your system for the proj.db file, and ,if you find it, set that directory (NOT the full file path) as your PROJ_LIB value, reboot, and see if things start working.

Add these commands to your code at the beginning before importing GDAL. Your issue will be solved.
import os
os.environ['PROJ_LIB'] = 'C:\\Users\\Sai kiran\\anaconda3\\envs\\sai\\Library\\share\\proj'
os.environ['GDAL_DATA'] = 'C:\\Users\\Sai kiran\\anaconda3\\envs\sai\\Library\\share'
import gdal
Search for the location of your proj.db file in your anaconda directory and replace the same location with C:\\Users\\Sai kiran\\anaconda3\\envs\\sai\\Library\\share\\projin the above command. Also, replace the location of gdal folder in the anaconda directory as in the above example.

Related

I install a python package with "pip install opencv-python" and it gives me a warning in Ubuntu

The warning it gives me is this:
WARNING: The scripts f2py, f2py3 and f2py3.10 are installed in '/home/minombre/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
How do I fix this?
Or can I just leave it like that?
even though I would like to fix it.
I am using for the first time linux ubuntu.
The warning message you are seeing is telling you that the scripts 'f2py', 'f2py3', and 'f2py3.10' are installed in the directory '/home/minombre/.local/bin', but this directory is not on your system's PATH. The PATH is a list of directories that your system looks in when you run a command. When you run a command, your system looks in the directories listed in the PATH for a file with that name.
You have a few options to solve this:
Add the directory '/home/minombre/.local/bin' to your system's PATH. This will allow your system to find the scripts when you run them. You can do this by editing the '.bashrc' file in your home directory and adding the following line at the end of the file:
export PATH=$PATH:/home/minombre/.local/bin
Use the full path to the script when you run it. Instead of just
running f2py, for example, you would run
'/home/minombre/.local/bin/f2py'
Use the '--no-warn-script-location' flag when you install the package.
This will suppress the warning message but it will not add the
directory to your PATH.
pip install opencv-python --no-warn-script-location
It's important to note that if you are not going to use the scripts that are giving the warning, you can safely ignore the warning.
It is also important to mention that you can also check your PATH by running in the terminal:
echo $PATH
and it will show you the list of directories.

Could not locate zlibwapi.dll. Please make sure it is in your library path

I am working on a object detection project and wanting to process the project with my GPU. I have completed the NVIDIA setup tutorial and everything works fine. My object detection code originally works with the CPU, however when I add these two lines of code:
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)
the output displayed:
Could not locate zlibwapi.dll. Please make sure it is in your library path!
I have downloaded the zlibwapi.dll zip file stated from the cuDNN website, unzip and added the whole folder into my environment variables paths. The folder is called "zlib123dllx64" containing a "dll_x64" folder and a "static_x64" folder. The "zlibwapi.dll" is inside the "dll_x64" folder. I have added the "zlib123dllx64" folder in the user and system path variable but it doesn't seem to fix any of the problems. How can I fix this error and make the GPU work with the code?
My environment setup:
Windows 10
Visual studio community 2019
OpenCV Python yolov3
Windows Environment:
I faced this issue of "Could not locate zlibwapi.dll. Please make sure it is in your library path" when I am trying to run a TensorRT sample, int8_caffe_mnist. To confirm proper installation of TensorRT.
Following the instructions from: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#prerequisites-windows
Under 3.1.3 download zlib and add the path to the environment variables.
I did the following:
Windows search for Edit the system environment variables
Add library path, Environment Variables -> Path -> Edit -> C:path to\zlibwapi.dll
Conclusion:
Following the instructions for adding zlibwapi.dll to the path did not work for me.
Solution that worked for me:
Removed the library path under Environment variables
copied zlibwapi.dll to C:\Windows\System32 and C:\Windows\SysWOW64
Either delete/keep zlib123dllx64 file, I choose to delete as it does not need the location to library path
I was able to find a copy of the missing zlib DLL in the NVIDIA Nsight directory:
C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\host-windows-x64\zlib.dll
I copied and renamed it to:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\zlibwapi.dll
since that was already in my PATH environment variable. Doing that resolved my error.
I saw the link in the CUDNN documentation that was linked in the other answers, but I was a little concerned by the security warnings.
Stumbled across this problem too and there is an easy fix that immediately worked for me:
Check out Nvidia's page (exact link where to download) and download.
Extract the files and simply find the single file "zlibwapi.dll". Copy this file to
C:/path to/NVIDIA GPU Computing Toolkit / CUDA/ v11.X / bin -> right here in that folder
Just did those two steps and it's TF can properly use GPU.
Download and extract the zlib package from http://www.winimage.com/zLibDll/zlib123dllx64.zip for 64 bit windows then copy the zlibdll file into cudnn/bin
If anyone also got the same problem as me, I managed to fix the problem. Instead of calling the whole "zlib123dllx64" folder into the system environment path, you simply just add the "zlibwapi.dll" inside the "dllx64" folder into your project folder and include it in your project. This fixed my problem. cheers
Didn't find zlibwapi.dll in bin but solved it anyhow.
Since I didn't have it in
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\
I couldn't change environment variable but I found it elsewhere.
mhartlove suggested here:
https://forums.developer.nvidia.com/t/could-not-load-library-cudnn-cnn-infer64-8-dll-error-code-193/218437/17
Solution:
"I found a copy of the 64 bit zlibwapi.dll hiding under a different name in:
C:\Program Files\NVIDIA Corporation\Nsight Systems 2022.4.2\host-windows-x64\zlib.dll
I copied and renamed it to:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\zlibwapi.dll
since that folder is already in my PATH variable; and it worked. Turns out the CUDA Toolkit already has the file you need elsewhere. Seems like they could save a lot of trouble if they just made a change to the CUDA Toolkit installer.
"
I downloaded the dll file from https://www.dllme.com/getfile.php?file=38308&id=9b45296e316cdf31b9bace739e22ca7a
Extracted it
see here
renamed
zlibwapi_x64.dll -> zlibwapi.dll
and pasted it in the bin of my CUDA
Look at the last file
This worked for me....

I am getting error when I am compiling xmlbeans : java io.ioexception cannot run the program "javac"

I am trying to run a sample of xmlBeans to compile a xsd and create a jar corresponding to that but I am getting this error again & again
java.io.Exception: Cannot run program "filelocation\javac": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start
............
It might be related to my "path" or "classpath" environment variable. Please suggest something.
I found the solution to the issue
I was using a command
scomp -out automobile-policy.jar automobile-policy.xsd
but there was some problem with the javac location in the path variable i guess
So I gave this command
scomp -compiler "c:\Program Files\Java\jdk1.6\bin\javac.exe" -out
automobile-policy.jar automobile-policy.xsd
and it gave the desired automobile-policy.jar at the location.
Please note that the location of the javac.exe might be different.

Setting Java path on Windows for Ant

Just downloaded the latest version of Ant and installed at:
C:\apache-ant-1.8.4
I added the following to the Env Path variable:
...;C:\apache-ant-1.8.4\bin
When I open a terminal window and type:
ant -version
I get:
Files\Java\jdk1.7.0_07"" was unexpected at this time.
In System variables I have the variable JAVA_HOME set to:
"C:\Program Files\Java\jdk1.7.0_07"
so it appears that "ant -version" is struggling to read the space in JAVA_HOME even though it is in quotes.
I see an alternative post on this topic:
Ant and Eclipse
but it doesn't tackle this specific point.
Has anyone else encountered this problem and know the answer?
My guess is current definition of JAVA_HOME has unwanted double quotes. Show output of set JAVA_HOME on command window. It should not have any double quotes.
Please start command prompt. Set the JAVA_HOME again
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_07
Hmmm, it should be fine with quotes. Could be something else in your path. If all else fails you could revert to dos 8.3 notation.
dir /x
Which gives
13/01/2013 03:57 PM <DIR> PROGRA~1 Program Files
13/01/2013 03:57 PM <DIR> PROGRA~2 Program Files (x86)
In case anyone else is still encountering this problem, I am on Windows 7 and was experiencing the same. I was using the GUI provided by right-clicking the "computer" icon to attempt to set the JAVA_HOME path to the relevant program files folder (C:\Program Files (x86)\Java\jdk1.7.0_45). This will not work! The GUI doesn't accept spaces in paths. Command line however, does. Use set JAVA_HOME= C:\Program Files... to get it working, filling out the rest of the path with the location of your jdk installation.

Grails installation

I am trying to install grails in my windows 7, I have installed JDK 1.7.0 and downloaded grails from its site and extracted in path "C:\grails", i have jdk in "C:\Program Files\Java\jdk1.7.0". I have set environment variable JAVA_HOME = "C:\Program Files\Java\jdk1.7.0\bin" and GRAILS_HOME = "C:\grails" and added "%GRAILS_HOME%\bin" and JAVA_HOME to path from advanced settings. But when i try to run "grails -v" or "grails help" i get the error "The system cannot find the path specified.". I even changed my directory to "C:\grails" and ran "grails -v" but it is still giving me the same error.
I dont know what is wrong with it, please help me installing this thing.
Thanks
JAVA_HOME = "C:\Program Files\Java\jdk1.7.0\bin" mustn't include 'bin'
You'll want to verify that Java is working correctly first by entering "java -version" at the command line.
When you say you extracted the zip into "C:\grails" does that directory now just have a single sub directory (i.e. "grails-2.5.0" or whatever version you downloaded), or does it contain a bunch of sub directories (bin, conf, dist, doc. etc)?
If the answer is the former, your GRAILS_HOME should point to "C:\grails\grails-2.5.0" instead of just C:\grails\

Resources