Questions tagged [c]
C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.
42
questions
8
votes
0
answers
1k
views
Fuller/Dymaxion in proj4/gdal/qgis?
I know this question has been asked a million times already, but I can't find many detailed responses on exactly what I want to do.
As far as I can tell, the full C code for the fuller projection is ...
7
votes
1
answer
2k
views
If degrees is zero, how should Degree Minute Second notation reflect the positive/negative hemisphere?
If degrees is zero, how should Degree Minute Second notation reflect the positive/negative hemisphere? What is the appropriate behavior when degree is zero? Basically this is a Signed Zero problem. ...
6
votes
0
answers
361
views
What is the structure of Standard Interchange Format (SIF) used by spatial data providers?
What is the structure of Standard Interchange Format(SIF) used by navteq and other spatial data providers? Any documentation/sample files? Is there a SIF parser available in C/C++/Java/PHP ?
5
votes
0
answers
85
views
Implementing PostgreSQL extension using PostGIS types?
I would like to create a new data type for PostgreSQL/PostGIS, but I have some difficulties. Here's what I've done so far:
/* PostgreSQL */
#include <postgres.h>
#include <liblwgeom.h>
#...
4
votes
2
answers
2k
views
How to use GDALGridInverseDistanceToAPower in a python script
I'm trying to use GDAL in a python script to do an inverse distance interpolation. Within the C documentation API I found GDALGridInverseDistanceToAPower function but I don't know how/if I can call ...
4
votes
1
answer
2k
views
How to speed up rasterio.transform.xy
REPRODUCIBLE SETUP
In a Google Colab notebook, I install rasterio:
!pip3 install rasterio
Import modules:
import rasterio
import numpy as np
import time
from rasterio.crs import CRS
from rasterio ...
3
votes
1
answer
916
views
Converting grid corners from UTM to degrees, minutes, and second in QGIS
I have a shapefile of a 10km grid that is in UTM projection but I would like to convert all coordinates to Degrees, Minutes, and Seconds. The attribute table has corners (Top, Bottom, left, and right)....
3
votes
1
answer
4k
views
How to find the minimum perimeter oriented bounding box?
I would like to know an algorithm to calculate the minimum perimeter oriented bounding box of a point set or polygon. I know that if I use the rotating calipers, I am able to get the minimum area ...
3
votes
1
answer
130
views
How to cancel 'GDALWarp()' in GDAL Utils (C API)?
My iOS app allows users to reproject rasters to different spatial reference systems. This is implemented with GDAL Utils (C API, in a Swift wrapper) to run a GDALWarp(). Sometimes these operations ...
3
votes
0
answers
269
views
Is it possible to proceed direct geo-referencing and ortho-rectification for a GeoTIFF with GDAL/OpenCV in one step
I work under Debian Linux and want to ortho-rectify and geo-reference images aquired by a tilted twin camera system using:
the attitude parameter (roll, ptich and heading) of the gyro-stabilized ...
2
votes
2
answers
553
views
Projection for polygon intersection confined into one hemisphere?
I have polygons where each vertex is a (lon,lat) geographic coordinate. I want to find out if they intersect or contain each other. The polygons are guaranteed to never exceed a hemisphere (so they'll ...
2
votes
1
answer
424
views
C-based implementation of Djikstra's or Fast Marching for QGIS/Python?
I need an algorithm to find least cost paths between points on a discrete grid,
allowing for the direction of transport to affect the cost of transport,
allowing for different modes of ...
2
votes
1
answer
415
views
Clip raster with postgis outputting result in clipping geometry extent
I want postgis st_clip to output clipped result in extent of initial clipping geometry.
Currently, it's crop option can be set to output either in initial raster extent or in extent of intersection ...
2
votes
2
answers
2k
views
Getting GeoTIFF tags with C
I am trying to make a code to read and retrieve geographical and raster data from a GeoTIFF file, but I'm having a hard time with the extended tags.
I have no problem with the regular TIFF tags (like ...
2
votes
0
answers
129
views
What is the issue with geopdf format? [closed]
I'd like to add the geopdf format as output of a library that I am working on. After have looking around, I have not been able to find a (c, c++, python) library that meet my license requirements (...
1
vote
1
answer
406
views
ReadAsArray() equivalent in C
I'm new with GDAL ... and I'm trying to write some code where I have to read a .raw image and store it as an array of 32-bit floats. It seems that it is easy with python, I just have to use:
array = ...
1
vote
1
answer
597
views
Print and write the WKB to another shapefile using OGR_G_ExportToWKB in C?
I want to convert the geometry to well known binary (WKB) format of my shapefile. I want to print and want to write it into another shapefile.
My code is:
#include <stdio.h>
#include <...
1
vote
1
answer
138
views
Getting DEM data programmatically with libgdal?
I'm writing a specialized tool in C to work with DEM data (typically GeoTIFF files, but one of the reasons I'm using libgdal is to leverage its ability to read multiple formats).
I'm able to open a ...
1
vote
1
answer
1k
views
Run-time pointer NULL error in C with OGR
I want to find out the geometry column and then want to export the geometry to WKB format from a shapefile. I wrote a code in C to find the geometry column. But a run-time error occurred. Can you ...
1
vote
0
answers
120
views
GDAL fails to get SRS authority or SRS code for OziExplorer .map file
Using GDAL C API (version 2.2.2), I've been unable to extract the Authority (or Authority Code) from a raster. I can get the Spatial Reference System, and print the WKT from the SRS, but querying the ...
1
vote
1
answer
913
views
How to run equivalent of gdal2tiles using GDAL C/C++ API?
GDAL includes a comprehensive low-level API in C and C++. It also includes some high-level APIs that effectively run the equivalent of some of the GDAL command-line utilities. (See:
https://gdal.org/...
1
vote
0
answers
476
views
Cannot Compile and add GDAL library for Visual C++ project in Visual Studio IDE
I wanted o create a project using the GDAL library and its API for C code.
I can create an executable for this code by entering the following on the command line in a Linux Machine:
gcc -o myprogram ...
1
vote
0
answers
191
views
Error: unable to open Unable to open %s.shp or %s.SHP
I am using c shapelibrary (http://shapelib.maptools.org/) SHAPE API for creating and reading shapefiles. I am able to create a new shapefile using SHPcreate(). However I am unable to read it using ...
1
vote
0
answers
800
views
ERROR 5: <band_name.tif>, band 1: Access window out of range in RasterIO(). Requested (0,76) of size 843402319x1 on raster of 10980x10980
I am trying to create a processing chain using C-GDAL. The main() code is as follows:
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "...
1
vote
0
answers
266
views
Get pixel value GDAL in C
I have the following code that works well to print out the individual values of pixels on a image (first band), using C-GDAL.
#include "gdal/gdal.h"
#include "gdal/cpl_conv.h"
#include <stdio.h>...
1
vote
0
answers
109
views
Cannot print the correct values of array in C - GDAL
I have the following code, which opens a raster file using C, then gets some attributes, and then declares in line :23 a variable called line, then I read the raster as array using GDALRasterIO.
#...
1
vote
0
answers
360
views
Python GDAL ReadAsArray vs C-GDALR
I am trying to iterate over the values of a raster dataset (band1). I am able to do it in python with the following code snippet (sorry I can't provide the original raster)
import numpy as np
import ...
1
vote
0
answers
139
views
Iterate over every single value in a Raster GDAL C API
I am learning C, and I am trying to use the C API to iterate over the values of an array. So far I've been playing around printing the projection, Width and Height of the raster, but I would like to ...
1
vote
0
answers
261
views
GDAL project lat lon coordinates to UTM in C
I have dug up some old code I wrote 6 years ago that was doing the conversion from Lat Lon coordinates to UTM.
I have tried to run it today and the code returns NaN values.
I suspect there has been ...
1
vote
0
answers
125
views
SEGFAULT when creating own index in postgresql for POINT3DZ
I'm trying to write my own index for 3d points - POINT3DZ (using pgis and postgres 9.4). I have written a code similar to spgquadtreeproc.c [1]
This is my spg_quad_point3dz_picksplit function:
...
1
vote
0
answers
294
views
Proj.4 get 3x3 or 4x4 projection matrix
How can I get a 3x3 or 4x4 transformation matrix between two CRS, using the proj4 library in C/C++?
It's OK if it makes some approximations.
1
vote
0
answers
34
views
Ingest 8-band satellite imagery into an array in C?
I’ve been unable to locate a lightweight library implemented in C to ingest 8-band geotiff files. GDAL can do this easily in python, though I’ve been unable to get the GDAL C libraries working; I’ve ...
1
vote
0
answers
64
views
What is the easiest way to write C extensions to Python for use in QGIS?
I would like to write some functions in C to call from the Python console in QGIS. What is the easiest way to do this? Does there exist anything comparable to Matlab's MEX?
1
vote
0
answers
56
views
To filter the wrong data of point positioning [closed]
I have collected GPGGA data by Novatel OEMV receiver in static single point mode. I have so much data (GPGGA format) and I want to get the static point axis by averaging all data. But some of the data ...
0
votes
1
answer
759
views
Why is GDAL isn't supporting .raw images?
I tried to open a .raw image (Raw image format) using GDALOpen() with GDAL C API. So, I wrote the following code to test it :
in_data = GDALOpen("/home/YOYo/workspace/NY/Data/fig.raw",GA_ReadOnly);
...
0
votes
1
answer
349
views
GDAL cannot read KML file that it just created
I'm using GDAL 2.2 standard C library within a Swift wrapper in an iOS app. After creating a KML data source and populating it with data, GDAL is unable to open the KML file that it just created. ...
0
votes
1
answer
307
views
RuntimeError: wrapped C/C++ object of type RasterizeStringAlgorithm has been deleted
There is a very similar problem to mine, but with a different plugin. The error is the same.
The error is this:
RuntimeError: wrapped C/C++ object of type RasterizeStringAlgorithm has been deleted
...
0
votes
1
answer
311
views
How to call GEOS error handlers provided during initialization (initGEOS)?
From what I learned, when using GEOS in C/C++, it should be initialized first using initGEOS :
extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
GEOSMessageHandler ...
0
votes
0
answers
88
views
Calling GDALGetRasterHistogram( ) from R
I need to calculate a histogram (pixel-count by each unique value, actually) for more than 256 values , the default number of buckets in gdalinfo.
I understand that GDALGetRasterHistogram can deal ...
0
votes
0
answers
260
views
Convert and set projection from h5 file
I want to save georeferences readed from input data to output data.
I don't want use copy georeferences because input data is in .h5 format and georeferences was read from metadata.
I use GDAL and C ...
0
votes
1
answer
3k
views
How to draw a shapefile over GeoTIFF geometry to a PNG [duplicate]
How I can to draw using GDAL in python or c a polygon shapefile shape.shp with a GeoTIFF as background background.tiff file?
Both files are in the same projection.
The result could be a PNG, JPEG or ...
0
votes
1
answer
526
views
Why having problem with GDALRasterize() in C?
I am trying to make raster file from a shapefile. I am trying to use GDALRasterize() function for it. But it is not recognizing GDALRasterize function ('GDALRasterize' was not declared in this scope). ...