my task is to create a QGIS plugin which loads a .tiff file and then snips the whole map in specified Raster like 1:25000 equals every 5 km. Im trying to do this with the gdal_warp function but for that I need shapefiles and i can't create shapefiles with random coordinates so I have to get upper left corner of the layer to start with.. One idea was with numpy, but i've got no idea how to load the layer in the 2D array If you guys got any other ideas im open for it..
72233
I have an image of size 1GB (.tif), with the width and height 94000x71680. I would like to chunk this image into 20000X20000 tiles so that I can process them.   How can I do this?
94401
I want to export/save a QGIS composition of raster/vector layers to a GEOTIFF or ECW raster with high resolution (20 000 * 20 000 Pixel).
30423
Given two input layers  The clip layer - an arbitrary layer (though in my case it's a float 1 band geotiff) The mask layer - a paletted raster in which every pixel is either NO DATA or a single &quot;color&quot; value, same for every pixel.  I want to create an output raster whose overall extent matches the extent of the mask layer and each pixel is either NO DATA if the corresponding pixel of the mask layer is NO DATA or the value of the corresponding pixel from the clip layer if the corresponding pixel of the mask layer is not NO DATA. I know I can mask the clip layer with a polygon, but the mask layer is a raster. Polygonizing the raster layer is possible in principle, but would result in a polygon with a lot of very short edges. Is there a direct way to do this in QGIS? I suppose there's probably a path that involves creating a new layer and using the raster calculator, but I'm hoping there's something more direct. Further complicating the matter is that the two rasters might not have the same resolution and origin. I believe this is equivalent to  in ArcMap.
116750
I apologize for the subjective "best" keyword.  My friend and I have started creation of a 2D adventure game. It will be top-down in the style of pokemon or zelda (just the perspective). We have been discussing methods of creating a large world-map that the player can traverse without straining the memory capabilities of our machine.  Our first impulse was to create a large map and a circle around the player in which content will be loaded. We figured this won't hold for long and decided to partition the map into sections. First we had four large sections, but realized we could simply break it down into many tiny sections.  I played some Zelda from the SNES and saw that, during the shift of a map, the content could be loaded just then. What I mean is, instead of just checking a rectangular area for data to load, we simply section the map into many tiny chunks that load and de-load data as we move from map-portion to map-portion.  Today, he told me he wanted to create a simply 2D array map[WIDTH][HEIGHT] that contains data about every grid in the game and is a constant save-to-disk operation for data that we don't need.  I'm not sure about these ideas and thought that I might as it here. Any links, resources or tutorials on the subject would be greatly appreciated as well as direct answers to our question on how to do it efficiently.
104565
Where is the ArcGIS 10 tool for creating a shapefile from current dataframe extents in layout view?  Have looked around and the closet thing i can find is Toolbox's Grid/Strip Map Index tools under Data Drive Pages.  I just want to be able to create a single polygon rectangle shp file based on the data frame (in layout view) for any given scale / page setup.
18513
I have about 50 pdf maps that I would like to batch georeference and/or georectify. I've saved one as a jpg and georeferenced it manually and would like to automate the rest which are in the same location and have the same extent.      The density gradient will change in each case, but the map (saved as jpg now) will have the same extent for all 50 cases.  Does anyone know of a link to a step-by-step tutorial that deals with batch processing in Arcmap 10.2 only? I'm thinking of using the  or possibly the  option, but am not sure where to start?  The sample code is:   import arcpy arcpy.WarpFromFile_management( "\\cpu\data\raster.img", "\\cpu\data\warp_out.tif", "\\cpu\data\gcpfile.txt", "POLYORDER2", "BILINEAR")
70041
I'm new to QGIS and have been seeing what it can do for me – seems good. I imported shape file data from a UK Ordnance Survey data file and saved the file in a new folder. It was very good, doing all I wanted. I exported and got exactly what I wanted ( a tiff image).   I closed the file in order to try a new experiment. When I went to re-open it I got a dialogue box saying 'Handle Bad Layers. I don't understand what is at issue and what to do.
16009
I have downloaded Globcover data in GeoTIFF format. I want to create a new grid which only has values where the Globcover data (the only band in the TIF file) has one certain value (==190).  Can I do this with GDAL?  If not, which way should I go? The procedure should be callable from a Shell script (Linux). I have QGIS installed (but no clue how to use it).
83700
Is it possible to create buffers for pixels of raster files? Actually I need to expand the pixels classified as 1 (in white in the figure) with a spatial range of 1 or 2 pixels, in order to perform some generalization.  I'm using QGIS, is this possible with gdal or something?
14111
How can I load multiple CSV files into QGIS with Longitude/Latitude already included in it. I downloaded the &quot;Load Them All&quot; plug-in, however, the result loaded was converted as text files and cannot be visualize on the map canvass. Any help? Are there any available plug-ins that can load multiple CSV file that will work fine in QGIS?
43376
I'm trying to white a Python plugin in QGIS (2.2) to get, for each pixel of a raster image, its X Y coordinates, as well as, its RGB (3 bands) values.  At first I opened the raster file using: rlayer = QgsRasterLayer(rfileName, rbaseName)  Now I don't know how to get, for example, for pixel (1,1) its coordinates (X,Y) and its RGB color values.  Anybody could help me?  I know that I'll need to implement a DO WHILE, but I don't know the commands to extract this information of each pixel.  Thanks in advance, Mateus
19042
I have a large collection of points with X and Y coordinates in a projected coordinate reference system (EPSG:28992). I would like to compute a square buffer around it (say, 500 meters around the point), so I can crop this polygon with a raster layer (in TIFF format) and proceed with a further analysis with the values within the cropped windows.  I am aware that this is possible in , but for the sake of the workflow I am implementing, I prefer to have it entirely in the Python GDAL environment, so it becomes automatic. Since I know the X/Y coordinates and the size of the grid cells in the raster, I could add/subtract to the coordinates the desired buffer, but I wonder whether there is a less handcrafted version of this "square-buffer" operation, which is less prone to errors. Other Python libraries (e.g. shapely) would be fine for me as well.   Note that a band.GetRasterBand(1).ReadAsArray(X, Y, 5, 5) does not return the window around the point, but the window leaving the point in a corner.   For instance, the following code:  path_curr_lyr = r"path_to_tif_file" tif = gdal.Open(path_curr_lyr) dat = tif.GetRasterBand(1).ReadAsArray(9550, 9620, 1, 1) print(dat) sq_buf = tif.GetRasterBand(1).ReadAsArray(9550, 9620, 5, 5) print(sq_buf)   Accesses the raster grid cell X/Y (9550, 9620) and returning the value of forest coverage in that pixel, and the value of a window of width= 5 pixels.  &gt;&gt;&gt; [[44]] &gt;&gt;&gt; [[ 44  87  99  86  43]      [ 96  99  99  79  14]      [ 99  99  98  34   9]      [ 99  86  27  93  71]      [ 98  98 100  97  65]]    As you can see, this approach returns a window in which the "44" is not a central value, but one in the corner. I would like to have a procedure in which a window around the given grid cell coordinate is created.  Any advice on how to implement this?
99559
I am looping over the features of a shapefile containing multiple polygons. If  certain criteria are met, I want to save the current feature in a new shapefile.  I am doing this using GDAL 1.10.0 with Python 2.7.3  The code runs, creates the files I want, calculates the area correctly. In the shapefile that is created, the attribute table contains the propoer fields ('name' and FID). Two things are wrong:   No polygons are visible (in ArcMap). This seems to me particularly weird, because the polygons seem to me proper, in the sense that they are closed (and the area is calculated properly).  The coordinate system seems off (in Arc Catalog there appears in the bottom -20,9667 0,0000 (are these degrees??)), despite the fact that I am creating a projection file (they are in German national grid 3)   Any hints as to what the problems could be? I tried to put the relevant excerpt of the code below:  from osgeo import gdal, gdalnumeric, ogr, osr, gdalconst  ### prepare shapefile into which to save driver = ogr.GetDriverByName('ESRI Shapefile') path_matched = r'.../.../path' datasource = driver.CreateDataSource(path_matched) lyr_matched = 'matched_%s' % cur_id  # from above # Remove output shapefile if it already exists name_shpfile = lyr_matched + '.shp' if os.path.exists(os.path.join(path_matched, name_shpfile)):     driver.DeleteDataSource(os.path.join(path_matched, name_shpfile)) layer = datasource.CreateLayer(lyr_matched, geom_type=ogr.wkbPolygon) #layer.ResetReading() field_name = ogr.FieldDefn("name", ogr.OFTString) layer.CreateField(field_name)  ### prepare file in which I want to write the areas of matched polygons path_area = path_matched file_area = 'matched_area_%s.txt' % (cur_id) fobj_area = open(os.path.join(path_area, file_area), 'w')  ### original shape file containing all polygons shp = ogr.Open(shp_all)  # os fobj from above lyr = shp.GetLayer()  # loop over polygons in original shameful for FID in featList:     feat = lyr.GetFeature(FID)      # this is from the shapefile      cur_name = feat.GetField(1)      # ... work on conditions ...      if condition = true:         myPoly = ogr.Geometry(type=ogr.wkbPolygon)         cur_poly = feat.GetGeometryRef()         myPoly.AddGeometry(cur_poly)         cur_spat_ref = cur_poly.GetSpatialReference()          cur_area =  cur_poly.GetArea()         cur_area_string = "%s \t %f \n" % (gw_name_EZG, cur_area)         fobj_area.write(cur_area_string)          featur_dfn = layer.GetLayerDefn()         feature_abc = ogr.Feature(featur_dfn)         feature_abc.SetGeometry(myPoly)         feature_abc.SetField("name", cur_name)         feature_abc.SetFID(FID)         layer.CreateFeature(feature_abc)         myPoly.Destroy()         feature.Destroy()   # generate projection file prj_filename = lyr_matched + '.prj' file = open(os.path.join(path_matched, prj_filename), 'w') targetSR = cur_spat_ref targetSR.MorphToESRI() file.write(targetSR.ExportToWkt()) file.close()   datasource.Destroy()
122960
I need to clip a large and very detailed shapefile in QGIS showing environmental data similar to a temperature map.   Is there something like the very simple crop tool like in Adobe Photoshop where you can drag a rectangle over an area of interest and crop the shapefile to this area only?  I do have an additional shapefile of neighborhoods/districts that I could also use for cropping but I do not know how to specify "extract a shp/kml only within the borders of district X, row xxxxx in the attribute table of districts.shp"  How can I extract the data primitively within a rectangle of choice or per district?  I need smaller pieces from the large map that has been provided by an environmental geo-institute to be implemented into an mobile Application (Android) to view the quite heavy data in a lighter way.   I made some screenshots of the data and posted them here: .  You can see the districts and the data layers. I need to have every district as a separate file / separately export every dataset per district to KML.
26278
Given a list of georeferenced rasters, about a hundred, what is the simplest method to generate  for each?  In this case the source rasters are either geotiff with embedded georeferencing or .BIL with accompanying .PRJ, but the ideal solution shouldn't care what the format is. I'm hoping to avoid duplicating data.  I have at my disposal Arcgis 10 (Arcinfo &amp; Spatial Analyst), GDAL Utilities (gdal v1.8.0), and Quantum GIS 1.8.
31469
I am using QGIS 2.18.4 Las Palmas on Windows 10 (32 bits).  I need to clip raster (TIF) 1 km resolution imagery files downloaded from MODIS using a shapefile mask of Argentina. To do so I tried to use the Clipper tool in the GDAL plugin. All of my layers are in the same coordinate reference system and I have the "Enable on the fly CRS transformation" option disabled.  After doing Raster &gt;&gt; Extraction &gt;&gt; Clipper &gt;&gt; Clipping mode: mask layer, I get the following error message:     Output driver 'AAIGrid' not recognised or does not support direct   output file creation. The following format drivers are configured and   support direct output: ...   followed by a list of 45 supported outputs.  After a thorough online search of related problems and potential solutions, I feel like I have exhausted all possibilities.   Could someone point me in the right direction please?
86909
I am in QGIS. I have a raster layer of mountains and a lake. I have a vector layer (shapefile) of the lake. It sits nicely where it supposed to be over the raster level. I am going to convert this height map to an STL so that I can cnc this out of wood, so I'd like the actual lake to be something like 200 feet lower than it shows on the raster layer so that I can fill it with blue epoxy. I have read a lot of clipping and everything else, and I am lost.