34

There's no need to edit batch files (and break python 2.7 in the process) or set environment variables manually. Just run py3_env which sets the shell up for Python 3 automatically, then run python3. From a OSGeo4W shell with just python 2 & 3 installed: C:\> o-help -={ OSGeo4W Shell Commands }=- dllupdate pip3 ...


17

There is a not well documented command build into OSGeo4W Shell which sets the shell up to python3 as Luke mentions py3_env Basically it sets your PYTHONHOME and the correct PATH. Then you can call Python3 with python3. C:\>py3_env C:\>SET PYTHONPATH= C:\>SET PYTHONHOME=C:\OSGEO4~1\apps\Python36 C:\>PATH C:\OSGEO4~1\apps\Python36;C:\OSGEO4~1\...


11

You can use the total_bounds property for this. Small example: In [83]: from shapely.geometry import Point In [84]: import geopandas In [86]: import random In [87]: df = geopandas.GeoDataFrame({'geometry': [Point(random.random(), random.random()) for _ in range(10)]}) In [93]: df Out[93]: geometry 0 POINT (0....


11

As documented in https://pypi.org/project/GDAL/ plain "gdal" is deprecated and you should not use that for writing any new code Additionally, there are five compatibility modules that are included but provide notices to state that they are deprecated and will be going away. If you are using GDAL 1.7 bindings, you should update your imports to ...


11

QgsPoint is a point class which supports Z (3D) and M values. (What are Z and M?) x, y, z, m = 10, 10, 20, 5 QgsPoint(x, y) # 2D # <QgsPoint: Point (10 10)> QgsPoint(x, y, z) # 3D # <QgsPoint: PointZ (10 10 20)> QgsPoint(x, y, z, m) # 3D and M # <QgsPoint: PointZM (10 10 20 5)> QgsPointXY is a point class used for just 2D representation ...


10

I encounter that problem after installing QGIS 3, too. Therefore, I install Python packages in following way: Copy python3.dll and python36.dll in (QGIS_PATH)/bin folder to (QGIS_PATH)/apps/Python36/ folder. Open command prompt as administrator. Go to Python36 folder. cd c:/(QGIS_PATH)/apps/Python36 Install Pyhon packages by python -m pip install ...


10

You can use "Split features by character" tool. uri = r"C:\impression_plan\mini\RSFFicheCanalisation.shp" layer = QgsVectorLayer(uri, "", "ogr") new_layer = processing.runAndLoadResults( "native:splitfeaturesbycharacter", {'INPUT': layer, 'FIELD':'NOM_CONCAT'...


9

This is not exactly what you asked for, but a workaround could be to add both IDLE instances to your Send To context menu option. open %APPDATA%\Microsoft\Windows\SendTo choose > New > Shortcut specify the path and command for IDLE, eg C:\Python27\ArcGIS10.2\pythonw.exe "C:\Python27\ArcGIS10.2\Lib\idlelib\idle.pyw" repeat for the other IDLE version Now ...


8

That's all controlled from the registry. You could open the registry and find HKEY_CLASSES_ROOT\\Python.File\\shell\\Edit with Idle and re-name that folder to something like Edit with Idle 2.7 You could then add a new reg key (for example copy this into notepad and save as "Idle3.4.reg", then double click to install the reg key) Windows Registry Editor ...


8

Python 3.6 has landed in QGIS 2.99:


8

To address @CodyBrown comments here: I don't know how this is opinion based. I am asking whether ESRI has plans to move to Python 3x in the near future or not. As answered below by James and Ann, they obviously do with Pro and thus probably will with Desktop, tat is if they continue with Desktop. As of today, there are no plans to move Desktop/...


8

If you want to make the change permanent you can modify the batch file OSGeo4W.bat located in your QGIS (or OSGEO) directory and just add: call "py3_env" below the line calling call "%~dp0\bin\o4w_env.bat"


8

Shapely knows nothing about your units. Therefore, when you call polygon.buffer(0.2), shapely will buffer the coordinates in polygon by 0.2 units. In your case, these are not meters, but degrees. If you want to buffer in meters, you first need to reproject your Polygon and Linestring into a CRS that uses meters. I would use geopandas for this, as it has a ...


7

According the documentation, when you're creating a CircleMarker object the fill parameter defaults to False. Try explicitly setting it to True in your code: #... for lt, ln, el in zip(lat, lon, elev): cm = folium.CircleMarker(location=[lt, ln], radius = 6, popup=str(el)+" m", ...


7

The projections differ in the datum shift values for the conversion from Amersfoort datum to WGS84. The first one is tfm code 4833, and the second is tfm code 15934. GDAL 2.1.0 uses tfm code 4833, while GDAL 2.2.0 and later uses tfm code 15934. The change was done in https://trac.osgeo.org/gdal/changeset/37081 According to the remarks, 4833 is the latest ...


7

This is a great question and I will do my best to answer. To begin, the init style syntax is deprecated (https://pyproj4.github.io/pyproj/stable/gotchas.html#init-auth-auth-code-should-be-replaced-with-auth-auth-code). So, instead of CRS(init="epsg:4544"), you should use CRS("epsg:4544"). I discovered that sometimes when intialising a pyproj Proj ...


6

You can start the Python IDLE GUI from the Start Menu using the ArcGIS Pro Python command prompt. Start Menu > All Programs > ArcGIS > ArcGIS Pro > Python Command Prompt This will open a command prompt window at the current ArcGIS Pro python conda environment. Typing idle at this prompt will open the IDLE GUI.


6

This summer Esri was saying that ArcGIS Pro will go Python 3. The legacy ArcGIS Desktop will stick with Python 2.x as long as it can. I believe there are a bunch of Python 3 migration ArcGIS Pro tutorials on Esri's support page. Python 3 migration ArcGIS Pro uses Python 3.4. This is a significant change from other ArcGIS products including ArcGIS for ...


6

First make sure you have the 32 bit PyScripter installed, not the 64 bit. Then in Tools -> Python Path make sure you have PyScripter pointing to the following paths: C:\Program Files (x86)\PyScripter\Lib\rpyc.zip C:\Windows\system32\python27.zip C:\Python27\ArcGIS10.2\DLLs C:\Python27\ArcGIS10.2\lib C:\Python27\ArcGIS10.2\lib\plat-win C:\Python27\ArcGIS10....


6

This happened to me as well and I had both QGIS 2.14 and 3.8 installed then. I fixed the pip install issue in my OSGeo4W shell by uninstalling QGIS2.14 from my computer and re-installing QGIS3.8. If you see the "SNIMissingWarning" in the error message, check out urllib3's documentation here and you'll find that your OSGeo4W shell might be running on an ...


6

It appears that gsconfig-py3 is less relaxed about the format of the base URL than gsconfig was. If it doesn't end / it doesn't think to add one for you. so cat = Catalog("http://localhost:8080/geoserver/rest/", username='admin', password='geoserver') does work. I would raise an issue and a fix for this if I was you.


5

If you are on Windows you could give the precompiled wheels by Christoph Gohlke a try, he has a stable 1.11 with bindings for Python 3.4 listed. If you are on Linux your best bet is compiling from source with support for your Python version (./configure --with-python).


5

As you can see from http://gdal.org/python/osgeo.ogr.DataSource-class.html#CreateLayer, CreateLayer support also "options" which are "None" by default. The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation. Usage example for PostgeSQL and Python ...


5

Your expression shouldn't include variable names. You're writing: "(+DemoField+ * !TractPercent!) / !BufferPOP!" but it should be: "(!{}! * !TractPercent!) / !BufferPOP!".format(DemoField.name)


5

You can visualize your data on a map using folium. Please visit Documentation. (You must also have/install jupyter package. Installing Jupyter Notebook) Then this script displays your data on an interactive map: import pandas as pd import folium map_ = folium.Map(location=[40.13, 116.25], zoom_start=10) df = pd.read_csv("PATH/YOUR/FILE/user141.csv"...


5

The statistics you need are the count of OBJECTID for each DFIRM_ID, so your onStatisticField should be OBJECTID instead of DFIRM_ID. The groupBy parameter should be set to DFIRM_ID: [{ "statisticType": "count", "onStatisticField": "OBJECTID", "outStatisticFieldName": "Count" }] Which would make your params variable something like this params ...


5

You don't need to define lambda function and to specify self.canvas.scale() and self.canvas.xyCoordinates(). Because scaleChanged event passes scale and xyCoordinates passes coordinates to the related functions you define, by default. Thus, try in that way: self.canvas.scaleChanged.connect(self.showScale) self.canvas.xyCoordinates.connect(self.showXY) Edit: ...


5

I just tried to install ipyleaflet with Jupyter 5.2.3: conda install -c conda-forge ipyleaflet and also didn't get a map. I then tried registering the extension with: jupyter nbextension enable --py --sys-prefix ipyleaflet since this is mentioned after the install with pip section. After restarting the kernel, the map was now displayed. Is ...


5

I'm assuming that you have set the datacube up (test that with datacube system check). Otherwise, get started with the following doc, cross-checking whether you've completed all the steps mentioned in it! CEOS-SEO - Get Started Step 1 :- Download Satellite images. Choose a dataset. e.g. Landsat 8 level 1. It can be downloaded from USGS Earth Explorer. ...


5

No, the problem does not have anything to do with ArcGIS or arcpy. SyntaxError means that there is a problem with the syntax of your program and it identifies this error before running anything. In your case, you have an opening parenthesis that should not be there and is triggering the error. On the line: structureMultiplier = (arcpy.GetParameterAsText(5) #...


Only top voted, non community-wiki answers of a minimum length are eligible