Hot answers tagged

4

a shapefile can only contain one geometry-type. For each of them, you have to create another shapefile. More info: https://gis.stackexchange.com/a/74629/7849


4

Yes, you can write a one bit raster with rasterio*. You need to: write to a format that supports a 1bit dataset, such as GeoTIFF; ensure your numpy array is np.uint8/ubyte so rasterio doesnt raise the TypeError: invalid dtype: 'bool' exception; and pass the NBITS=1 creation option to tell the underlying GDAL GeoTIFF driver to create a one bit file. import ...


4

If you call rasterio.dtypes.check_dtype(np.bool_) you'll see that it's not a known dtype, because gdal doesn't support a true 1-bit dtype. GDT_Byte is the smallest. The list that rasterio is checking against is: dtype_fwd = { 0: None, # GDT_Unknown 1: ubyte, # GDT_Byte 2: uint16, # GDT_UInt16 3: int16, # GDT_Int16 4:...


3

Your example is a MULTIPOINT. Members of a multi-point collection are accessed via the geoms property or via the iterator protocol using in or list(). Here's an example: >> from shapely import wkt >> from shapely.geometry import MultiPoint >> p = wkt.loads("MULTIPOINT (92 169, 100 163.552380952381, 105.2167832167832 160, 266....


2

This is really more of a IT/ PyQt question, so I will provide an answer in the context of QGIS plugin development, to try to keep on topic. The reason your mousePressEvent does nothing is that you have defined it inside your main plugin class. The mousePressEvent method is designed to be re-implemented inside a sub class which inherits from one of the ...


2

From the linked article (emphasis mine): The ArcGIS Server component of ArcGIS Enterprise also ships with Python. In recent releases, both Python 2.x and Python 3.x runtimes are provided. Below that, it is specified that versions 10.6 and higher come with Python 3.6.x and 2.7.x. I see no indication that 3.6 is not included in any 10.7 version. ArcGIS ...


2

I'm not sure why the order matters to you but the shapely manual shows wrapping the MultiPoint in a list: pprint.pprint(list(points.geoms)) so I would expect something like: points = MultiPoint(list(points.geoms)[::-1]) to work. Though the manual makes no claims that MultiPoints honour the order of the input list.


1

Don't know if this is the simplest way, but it saves gathering elevation data. The USGS-National Map has a REST service that you can use to query elevation for lat/lon coords. Service url: https://nationalmap.gov/epqs/ You can use pythons requests library and format your query string according to the service parameters. You need your input coordinates in ...


1

Yes you can pass an array. The documentation specifies: rasterio.plot.show(source, etc...) Parameters source (array or dataset object opened in 'r' mode or Band or tuple(dataset, bidx)) Yes, it's the same. Demo using rasterio.plot.adjust_band that show uses to do the adjustment: import rasterio.plot as rp import numpy as np def norm(...


1

I use Mac and QGIS 3.4 and got the same error. After checking the PyQt5 folder in QGIS, I found there is no QtChart file in the folder, which is the reason why we cannot import it. And the version of PyQt5 in QGIS is 5.11.3 The folder for PyQt5 in QGIS is /Applications/QGIS3.app/Contents/Resources/python/PyQt5 I have an anaconda version of PyQt5, which ...


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