Hot answers tagged

28

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 that masking through overlay of cells could be avoided) 2. Import to QGIS using "Add Delimited Text Layer" Choose X and Y fields and pick Datum Create ...


11

I've just released a prototype program Arc Raster Rescue which extracts raster data from the ArcGIS File Geodatabase format.


8

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, are the test bed for certain GIS standards. QGIS is an excellent solution for your needs as it has both desktop and server solutions but also comes bundled with ...


7

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 matter as all the drivers are registered GDALDataset* SourceRasterDS = (GDALDataset*) GDALOpen(Raster,GA_ReadOnly); double GeoTransform[6]; ...


7

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 = radians(lat2-lat); float delta2 = radians(lon2-lon); //==================Heading Formula Calculation================// float y = sin(delta2) * cos(...


6

Google Static map api requires centre,lat/lng and pixel size as well as zoom level This is a non-JavaScript version (but python) for working out the pixel dimensions. You will need to modify to suit your needs but the key point is that it contains CalculateBoundsZoomLevel Which take a cluster of points and calculate the zoom level and centre of the map ...


6

from pyproj import Proj, transform P3857 = Proj(init='epsg:3857') P4326 = Proj(init='epsg:4326') x,y = transform(P4326, P3857, lon, lat)


6

Esri shapefile fields are limited to 10 characters, no matter how they are created.


6

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.


5

Using QgsMapCanvasItem is the way to go here as you will not have to refresh the canvas. You just have to make sure your implementation is correct. Here is a basic example (taken from https://github.com/DMS-Aus/Roam/blob/master/src/roam/gps_action.py) class GPSMarker(QgsMapCanvasItem): def __init__(self, canvas): QgsMapCanvasItem....


5

Here are pretty recent examples for QGis C++ plugin development. QGis C++ plugin examples


5

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 = "/usr/lib64/qgis"; QString myLayerPath = "pathtoashapefile"; QString myLayerBaseName = "italy"; QString myProviderName = "ogr"; // ...


5

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() { OGRRegisterAll(); OGRDataSource *poDS; poDS = OGRSFDriverRegistrar::Open( "data.shp", FALSE); }


5

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 function: def isMyGroupSelected( groupName ): myGroup = QgsProject.instance().layerTreeRoot().findGroup( groupName ) return myGroup in iface....


5

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. Confusingly, vector datasources now expose methods that only apply to rasters... The GetProjectionRef method you are using applies to raster datasources and ...


5

GDAL supports open ESRI Shapefile and save it as DXF. The C++ API intro is here: https://gdal.org/ogr_apitut.html


5

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 LWGEOM_GEOS_makeValid* functions such as the polygon one in the file qgsgeometrymakevalid.cpp


4

Mapnik is a c++ toolkit for making maps and has python bindings – http://mapnik.org


4

If you're looking for something that's really easy to use and your lat/long data come from a shapefile, you could check out the Python Geographic Visualizer (GeoVis) module. It has no dependencies, requires no installation, and is very easy to use. In the newest version you can also zoom in on specific areas and symbolize based on attribute classification: ...


4

Here is a good paper which has a C++ focus. It seems very detailed, 147 pages.Automated Label Placement In Theory and Practice


4

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's used OGRRegisterAll(); OGRDataSource *hDS = NULL; OGRSFDriver *Driver = NULL; hDS = OGRSFDriverRegistrar::Open(BasePath,FALSE,&Driver); As you can see ...


4

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 the documentation here.


4

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; liblas::SpatialReference srs; srs.SetFromUserInput("EPSG:4326"); header.SetSRS(srs); header.SetPointRecordsCount(1); ofs.open("test.las", ios::out | ios::binary)...


4

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 smRadiansOverDegrees = Math.PI / 180.0; ... // compute x-map-unit vertex[0] *= smLonToX; double y = vertex[1]; // compute y-map-unit if (y > 86.0) { vertex[1] = ...


4

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 will be saved in the vector layer until you commit them, then they will be sent to the data provider. Edit Sessions In your example you start an edit session ...


4

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, while styling is organized by QGIS's layer. Nevertheless you can get individual styling based on the feature attributes. This is called a "Data defined override"...


4

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 use the QGIS 3.x classes and syntax: import os import socket from qgis.core import QgsProject from PyQt5.QtWidgets import QMessageBox ### utility functions ### ...


4

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++ API is not stable between QGIS releases (including point releases), so you need to update and recompile c++ plugins for each QGIS version used. (In contrast, ...


4

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\PostgreSQL\9.5\include . //To make use in C/C++, you include these header files #include "libpq/libpq-fs.h" #include "libpq-fe.h" #include <stdlib.h> #...


4

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 of your raster image. Each pixel has size, width and height and it is a value in meters or degrees (depends on your CRS) - this value is constant, not scalable, ...


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