Hot answers tagged

28 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 ...
user avatar
11 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.
user avatar
  • 1,761
8 votes

Is there a GIS-Tool that fit my needs?

For OpenSource GIS tech investigate the offereings available via OsGeo. This is not the only source of FOSS4G but is a comprehensive stable of solutions that work well together and, in some cases, ...
user avatar
7 votes
Accepted

Sample for MS Visual Studio C++ using GDAL library

Here's just the nuts-and-bolts from some working code: #include "gdal_priv.h" #include "gdal_alg.h" // in main()... GDALAllRegister(); // register all drivers // open your raster - format doesn't ...
user avatar
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 = ...
user avatar
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 ...
user avatar
  • 34.6k
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)
user avatar
6 votes

GDAL Truncating/Normalizing Field names

Esri shapefile fields are limited to 10 characters, no matter how they are created.
user avatar
  • 777
6 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.
user avatar
  • 26.3k
5 votes

Where can I find documentation on QGIS C++ Plugin Development?

Here are pretty recent examples for QGis C++ plugin development. QGis C++ plugin examples
user avatar
  • 261
5 votes

Looking for QGIS 2.4 C++ Hello World example?

I had your same problem. I solved it updating the code in order to match the QGis 2 major changes: int main(int argc, char *argv[]) { QgsApplication app(argc, argv, true); QString myPluginsDir ...
user avatar
  • 51
5 votes

GDAL in C++: Reading a ShapeFile

That solved my problem. Further information and a tutorial can be found here http://gdal.org/1.11/ogr/ogr_apitut.html A C++ version for GDAL 1.11: #include <GDAL/ogrsf_frmts.h> int main() { ...
user avatar
5 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 ...
user avatar
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. ...
user avatar
  • 52.5k
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
user avatar
4 votes

Error getting ESRI Shapefile driver OGR in C++

You're trying to use an OGR (vector) driver with GDAL (raster) tools. Here's a few lines of my working code that may help: char* BasePath = new char[FullPathMax]; // this does have a value before it'...
user avatar
4 votes
Accepted

Georeferencing las files using liblas

If you want to write a lasfile with SRS information, you must create your liblas::Writer using a liblas::Header that has a defined SRS. Change your code to this: ofstream ofs; liblas::Header header; ...
user avatar
4 votes

Generate delaunay triangulation from 3D(x,y,z) points

Using scipy and numpy: import numpy as np from scipy.spatial import Delaunay #do triangulation points = np.random.rand(4, 3) tri = Delaunay(points) #indices tri.simplices #points tri.points See ...
user avatar
  • 1,193
4 votes

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

This code snippet is C# and using an array called vertex to hold [x, y] double smRadius = 6378136.98; double smRange = smRadius * Math.PI * 2.0; double smLonToX = smRange / 360.0; double ...
user avatar
4 votes
Accepted

Is it possible to change the geometry without startEditing the layer

Data Provider vs Vector Layer A vector layer has a data provider which (normally [1]) is used to store data persistently. If you edit something on the layer with a normal edit session, your changes ...
user avatar
4 votes
Accepted

is it possible programmatically to rotate a svg of the feature without rotate all feature

In QGIS styling is layer based, so it is generally not possible to set different styles or different symbols for individual features. I think this is because features are handled by the data source, ...
user avatar
  • 1,970
4 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 ...
user avatar
  • 23.8k
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++...
user avatar
  • 26.3k
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\...
user avatar
  • 1,222
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 ...
user avatar
  • 6,404
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 ...
user avatar
  • 52.5k
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 ...
user avatar
4 votes
Accepted

Set Metadata domain with GDAL (python bindings)

You can do this by passing a dict: ds.SetMetadata({"X_BAND": "1" }, "GEOLOCATION")
user avatar
  • 52.5k
3 votes
Accepted

How to load a *.qgs file in a C++ QGIS standalone app?

The problem is solved by Matthias Kuhn, see Here. QgsLayerTreeMapCanvasBridge should help you there header: QgsLayerTreeMapCanvasBridge* mLayerTreeCanvasBridge; source: mLayerTreeCanvasBridge = ...
user avatar
  • 339
3 votes
Accepted

How to develop C++ standalone QGIS C++ Application

I recommend you OSGeo4W, it has all you need to build an QGis/Qt standalone application with MSVC 2010. Download it and install all the packages you need. Then you only need to configure you project ...
user avatar

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