Skip to main content
29 votes

Creating sectors for telecom towers

Telecom cell site plan and optimization using QGIS Create Points or Site Locations: Create database in CSV (make sure antenna sizes are sorted in descending order: highest first to lowest last, such ...
Vamsi Krishna Uppala's user avatar
12 votes
Accepted

Seeking open source solution to access rasters in File Geodatabase?

I've just released a prototype program Arc Raster Rescue which extracts raster data from the ArcGIS File Geodatabase format.
Richard's user avatar
  • 1,831
7 votes
Accepted

Calculate bearing between two decimal GPS coordinates (Arduino / C++)

You can calculate your bearing with this function. float bearing(float lat,float lon,float lat2,float lon2){ float teta1 = radians(lat); float teta2 = radians(lat2); float delta1 = ...
Mario Alzate's user avatar
7 votes
Accepted

Set Metadata domain with GDAL (python bindings)

You can do this by passing a dict: ds.SetMetadata({"X_BAND": "1" }, "GEOLOCATION")
user2856's user avatar
  • 66.4k
7 votes

Improving QGIS source code efficiency?

There's no inefficiency here. They are only c++ pointers to the same layer instance -- it's not two instances in separate memory of the same map layer.
ndawson's user avatar
  • 27.6k
7 votes
Accepted

Seeking code behind Fix Geometries tool in QGIS

The code is in GitHub. The Fix Geometries tool is a wrapper to the function LWGEOM_GEOS_makeValid, which then calls different functions for different geometry types. You can read the various ...
JGH's user avatar
  • 42.1k
7 votes
Accepted

Where is the source code for the Processing Plugin "Buffer"?

The buffer algorithm is implemented in C++: https://github.com/qgis/QGIS/blob/fbc2082b7e25042c5f82cb000c52d84625b31624/src/analysis/processing/qgsalgorithmbuffer.cpp The Buffer.py file you found is ...
bugmenot123's user avatar
  • 10.8k
6 votes
Accepted

Determining if a group in legend is selected, using PyQGIS

You can use QgsLayerTreeView (accessible from the iface object) for that. I didn't find a direct way (QgsLayerTreeGroup doesn't seem to have a method for that), but you can simply reuse the following ...
Germán Carrillo's user avatar
6 votes

Converting latitude, longitude (EPSG:4326) into EPSG:3857?

from pyproj import Proj, transform P3857 = Proj(init='epsg:3857') P4326 = Proj(init='epsg:4326') x,y = transform(P4326, P3857, lon, lat)
Marcel Wilson's user avatar
6 votes

Open QGIS project files in exclusive mode / alert if project file already in use

Took me a while to find: a long while ago I had a naive lock file implementation in place, using Python Macros (activate and alter in <QGIS>|Project|Properties...|Macros). I updated the code to ...
geozelot's user avatar
  • 30.3k
5 votes
Accepted

How to get coordinate system info from shapefile using GDAL/OGR?

Is there a different mechanism for vector files? Yes. Although the vector and raster drivers were merged in GDAL 2x, you still need to know which methods apply to rasters and which are for vectors. ...
user2856's user avatar
  • 66.4k
5 votes
Accepted

Existing C++ libraries that convert ESRI shapefile to DXF/DWG

GDAL supports open ESRI Shapefile and save it as DXF. The C++ API intro is here: https://gdal.org/ogr_apitut.html
Dmitry Baryshnikov's user avatar
4 votes
Accepted

QGIS CPP multi-platform plugin deployment

It's generally discouraged to write c++ QGIS plugins, for the following reasons: They can't be distributed via the plugin library (only python plugins with no binary dependencies are accepted) The c++...
ndawson's user avatar
  • 27.6k
4 votes

Seeking C++ api to read/write PostGIS?

libpq allows us to connect to Postgres/postgis for read write operations. If you have installed Postgres,libpq is already available.It would be available at installation path like C:\Program Files\...
addcolor's user avatar
  • 1,294
4 votes

Understanding how `gdalwarp` works under the hood

GeoTransform is an array that contains six numbers: X origin Pixel width Angle (with vertical axis) Y origin Pixel height Angle (with horizontal axis) X and Y are coordinates of the top left corner ...
dmh126's user avatar
  • 6,742
4 votes
Accepted

Why does GDAL open a DTED file as a vector format?

You can use GetRasterCount() to test if the dataset is raster and GetLayerCount() for vector. http://osgeo-org.1560.x6.nabble.com/Discover-whether-a-GDALDataset-is-raster-or-vector-td5270223.html ...
user2856's user avatar
  • 66.4k
4 votes

How to get long, lat and altitude info from geotiff file using GDAL and C++

I'm not sure what you mean by "for each pixel". look at the raster API tutorial: http://gdal.org/gdal_tutorial.html. specifically look at the section "Getting Dataset Information". do you want to get ...
Reilly's user avatar
  • 306
4 votes
Accepted

Understand QgsRuleBasedLabeling

Rule keys and provider IDs are equivalent. The issue in your code is that you clone the root rule (rl->rootRule()->clone()) and so the new tree of rules gets new rule keys (=provider IDs). I ...
Martin Dobias's user avatar
3 votes
Accepted

Selecting several layers programmatically using PyQGIS?

I couldn't find the way directly from the QGIS API. However, you can achieve it using Qt4. You need to temporarily set the selection mode of the layer tree view to multi-selection, select all your ...
Germán Carrillo's user avatar
3 votes
Accepted

How to reuse memory pointer of GDAL Memory driver

The issue was resolved in the gdal-dev mailing list, here's how: create the MEM driver and create the mem image with 0 bands Get the pointer to your allocated memory with CPLPrintPointer Use AddBand ...
quimnuss's user avatar
  • 193
3 votes

How check in python, cmake or c++ if ArcGIS license is valid

In python you can check it using arcpy extension. Here is code. You can also check the extension that are available in ArcGIS import arcpy print arcpy.ProductInfo() ## Check out the ArcGIS Spatial ...
Ahsan Mukhtar's user avatar
3 votes

How to get coordinate system info from shapefile using GDAL/OGR?

Based on the answer from @Luke, the following is my C++ implementation. I detect whether the file is raster or vector, using a utility function mentioned in another post also answered by @Luke. ...
Mike Finch's user avatar
3 votes
Accepted

QT C++ application using QGIS API

I found the right combination of the above mentioned items to make it possible for Qt to import Qgis libraries and build the app: Qt 4.8.6 for MSVC2010 Qt Creator 4.3.0 (from a Qt 5.9.0 installation)....
Diego Sartori's user avatar
3 votes

Faster way to find nearest neighbors with LASlib?

You need to use the spatial indexing capability available within LASlib. Here is an example for running a query on one point that is known a priori. Note that you need your LAS file to have an ...
LAStools's user avatar
  • 1,184
3 votes
Accepted

GDALOpenEx define papszOpenOptions

As for me the easiest way is using CSLAddNameValue char **papszOptions = nullptr; papszOptions = CSLAddNameValue(papszOptions, "KEY", "VALUE"); Don't forget to free options list after using: ...
Dmitry Baryshnikov's user avatar
3 votes
Accepted

How to open .hgts file from NASADEM data

Those .hgts files are in the same general format than the .hgt files, however they contain the elevation data in 4 bytes floating point numbers instead of 2 bytes integers. Global Mapper won't ...
Camilo Rada's user avatar
  • 1,219
3 votes

(c++) Advanced Geospatial Analysis Library

GEOS? I'm not sure what your definition of "lightweight" is, or whether anything can be both "lightweight" and "advanced" but GEOS is the main open-source geographical ...
Spacedman's user avatar
  • 64.3k
3 votes

Get a list of all supported EPSG code from OGR

You can reference the EPSG Dataset maintainted by the International Association of Oil & Gas Producers (IOCP) The IOGP’s EPSG Geodetic Parameter Dataset is a collection of definitions of ...
whyzar's user avatar
  • 12.1k
3 votes
Accepted

Get a list of all supported EPSG code from OGR

If you have proj 6 installed, you can query the proj.db file to get the list of EPSG codes it supports. On my machine, the following works: sqlite3 /usr/share/proj/proj.db "SELECT code FROM ...
Mathias Rav's user avatar
3 votes

Got Pacman instead of circle when buffering point QGIS 2.14 standalone C++ application

I am working on QGIS 3.6, I've translated your code in Python 3 (few changes from PyQgis 2.x, for example fromPoint, QgsPoint and QgsMapLayerRegistry.instance()) and it's working perfectly : ...
J. Monticolo's user avatar
  • 15.7k

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