Trying to open shapefiles - python

I have a number of companion files for a shapefile - .cpg, .dbf, .prj, .sbn, .sbx, .shp, .rtree, .shx
I have tried downoading a number of free softwares that open shapefiles such as TatukGIS viewer and DBF Reader Plus but with no luck.
I've attempted to open them in Python as I read this article:
http://www.acgeospatial.co.uk/geopandas-shapefiles-jupyter/
I'm having trouble installing geopandas however. I get this error when I try to run:
I've looked into these errors and tried using upgrade setup tool
Totally lost, have no idea what this error means when I look it up

As to you original question, try QGIS software. Among lots of features it surely can open Shapefile as well as many other geospatial formats.
As to the error you've posted, it's related to user permissions and was already answered, e.g. here Access is denied when trying to pip install a package on Windows.

Apparently geopandas is notoriously difficult to install, especially on Windows. To install geopandas, first install Conda, open the Anaconda Prompt as administrator and type:
conda install -c conda-forge geopandas
Found the answer on here:
https://www.reddit.com/r/gis/comments/as5rze/what_does_this_geopandas_installation_error_mean/
You can then use geopandas to open shapefiles

Related

Problem with graphviz, ExecutableNotFound error

I have a problem with installing graphviz in PyCharm. Im using windows. I already installed graphviz library onto my PyCharm project, however error occurs when executing dot.render:
graphviz.backend.execute.ExecutableNotFound: failed to execute WindowsPath('dot')
I tried adding
import os
os.environ["PATH"] += os.pathsep + 'D:/Program Files (x86)/Graphviz2.38/bin/'
as said here: "RuntimeError: Make sure the Graphviz executables are on your system's path" after installing Graphviz 2.38
but it still doesent work?
any ideas?
Im new to pycharm and advanced coding in general, go easy please...
This is a very common problem. While it may have several causes (see suggestions above), the solution you found is out-of-date.
Unfortunately, there are two software systems named Graphviz. You need both.
Go here https://graphviz.gitlab.io/download/ and download the appropriate version.
To check that you have installed the "real" Graphviz package, bring up a cmd window & type dot -V

Python: Where do I find packages like "gf" for the Anaconda Navigator and how do I install them? Python Version 3.6

this is my first question here;-)
I am using Python 3.6 via Anaconda Navigator (1.7) and that program shows a list of packages when I click Environments.
Are these packages directly useable or do I have to start any process therefor?
In a script I want to use the import-function for the package "gf", this one is not in the list above.
Where do I find it in a compatible form and how can I make it useable?
Anaconda says it has to be .yaml or .yml (Conda environment files) or .txt (Conda explicit specification files or pip requirement files)
I know the other way with the command line and WHL files, but Anaconda does not seem to have any command line as the kind-of-user-guide says.
First I tried renaming other install files to .txt, but Anaconda just took ages and got a serious problem that I had to restart it several times.
I also tried to check https://anaconda.org/conda-forge for "gf", but it seems not available there.
Best Regards
By GF, do you mean Grammatical Framework (https://www.grammaticalframework.org/)? If so, then you can't install it via Anaconda. Maybe you would be interested in one of the following options?
Jupyter kernel for GF
From https://github.com/kwarc/gf_kernel#readme:
gf_kernel is a Jupyter kernel for the Grammatical Framework (GF) . It allows you to write grammars and using them for parsing/translating/... all in one notebook, which makes it great for demos and teaching, but also for small experiments with GF.
You need to have GF installed: see https://www.grammaticalframework.org/download/index.html for options.
Using GF grammars from an external Python program
Python bindings to the PGF library are included in the GF binary, so if you have Mac or Ubuntu, the easiest way is to download the binary.
For other systems, see this blog post for how to install.

install legacy versions of python from source on windows 10

I would like to install older versions of python for use with virtual environments, ideally from source as these versions are readily available on the official python website python 3.6 here however I can't seem to find any decent instructions.
The link above has version 3.6 full link to the tar.gz here. It downloads, I move into to program files and unzip it with 7zip:
C:\Program Files\7-Zip\7z.exe e Python-3.6.9.tgz
Then unpack the tar file:
tar -xvzf Python-3.6.9
There is no python.exe file in the unpacked directory to add to my path?
Am I missing a build step perhaps?
I found some more instructions here - where there really should be good instructions!, git is installed and setup, as is vs-code. I ran :
PCBuild\build.bat
The file 'PCBuild\pcbuild.sln' appears to have been successfully produced. Now what? I run the test described here
rt.bat -q
And I get: The system cannot find the path specified
For some reason when I run build.bat, a lot of what is printed to the seems to be mentioning python 3.8 which is now the default install on my system, its as if this method is not even pointing to the right version of python.
Please note I am looking specifically for native python approaches to this - NOT conda approaches as it is incompatible with a number of things I am doing.
I've tried; another SO queation, another SO question, here, and here, also here.
Many install guides seem to show only how to install the latest version of python using the python installer, which doesn't seem to be able to be used for legacy versions of python.
Also pythons official site has a link at the bottom labelled ' tools for unpacking archive files' which one would presume would help you to unpack, possibly even install archive files, however the link just takes you back to the top of the page?
Any help would be much appreciated?

Python Geopandas throwing "Shell is not a Linear Ring" Error

I am new to python and I am trying to open a shape file but when I open the file I am getting a message that says "Shell is not a Linear Ring" Message when I try and open it via command line. My code is two lines long so I am not really sure whats going on here...
Code:
import geopandas as gpd
gdp.read_file("tl_2016_17_tract.shp")
Error:
"Shell is not a LinearRing"
I've also tried opening the shape file with R and QGIS and both worked fine. I think it might have something to do with my installation of python because I was having some issues with that earlier. I can't find a good explanation of the error "Shell is not a LinearRing" anywhere!
Thanks for the help!
A user with the exact same problem said:
I resolved this issue - I believe it had to do with geopandas and how it was installed. I resolved it by using:
conda remove geopandas
I originally installed via conda-forge channel
and then installing via pip:
pip install geopandas
I also went through and installed some packaged via homebrew, but I am not sure if that made a difference.
Source

How to install something that read excel files in python 3.3

I am new to python and I need to read an excel file in pyscripter. I understand that I should
import xrld
in Python and then use:
book = xlrd.open_workbook(os.path.join(file_source,file_name +".xlsx"))
to open and read the excel file.
However, I just don't understand how to install this module 'xrld'. I have looked on several websites and even on stackoverflow itself, but I just don't understand anything from the explanations that are given. I just don't understand how to install 'easy install' or 'pip' (or understand what these things are in the first place) or understand how to install anything else I need to read an excel file for. So far I installed a file called 'setuptools-36.01.1' from https://pypi.python.org/pypi/setuptools which should contain something I could use for running, but I just don't understand what to do.
I thereby must admit (and think it is clear by now) that I am a real noob when it comes to programming or computers in the first place.
Can someone please help me by explaining in plain English what exactly to do in order to read an excel file in python. I have Python 3.3.2 and use Pyscripter to run my simulation.
Your help would be really appreciated!
EasyInstall (easy_install) gives you a quick and painless way to install packages remotely by connecting other websites via HTTP.
Pip is a package management system used to install and manage software packages, such as those found in the Python Package Index. Pip is a replacement for easy_install.
Since you have installed the setuptools, easy_install will be already present in your system.
So just run easy_install pip in the command line to install pip . Then pip install xlrd for installing xlrd.
example code:
import xlrd
workbook = xlrd.open_workbook('C:/User/myaccount/Book1.xls')
worksheet = workbook.sheet_by_name('Sheet1')
print worksheet
Please go through this link-Reading Excel file using Python XLRD for sample codes for reading data from excel files in python.
Hope this helps you..

Categories

Resources