[Qgis-user] How to get rid of the rest of the World?

Murkor mharte at ozemail.com.au
Wed Apr 23 02:44:55 PDT 2014


"how to make a rectangular area of longitude and latitude
coordinates that enables to cut away the area not needed in other layers?"

In QGIS 2.2 (and just about any GIS that has geoprocessing tools) there are
two ways to "extract data".

The first is to "clip" the data from the existing file using another polygon
file:
1.  on the "manage layers" toolbar click "New Shapefile Layer";
2.  enter info on file geometry (polygon), name, and coordinate system
(don't need to worry about attributes);
3.  click 'OK";
4.  name file and choose storage location;
5.  click "Save";
6.  name of new file appears in 'Layers List";
7.  click on name of new file to highlight it;
8.  on the "digitising" toolbar click "Toggle Editing" (little pencil
button);
9.  click "Add Feature" button;
10.  click in map window to create your polygon (left click for each corner
and right click to finish);
11.  click "Save Layer Edits" button;
12.  click 'Toggle Editing" button;
13.  in menu click "Processing... Toolbox";
14.  in toolbox (simplified view) search "clip";
15.  double click "geoalgorithms... vector... overlay... clip";
16.  input layer is the layer you want to clip (make smaller);
17.  clip layer is the polygon you just made;
18.  clipped output is what and where you wish;
19.  click "Run"

NOTES:
-You can turn on any toolbars that you don't see in the menu under
"Settings... Toolbars"
-If you load the layer you want to clip into the map window before clipping
it means you don't have to navigate to it; you can just pick it from a
dropdown.
-MAKE SURE THE COORDINATE REFERENCE SYSTEM (CRS) FOR THE PROJECT (Setting...
Project Properties... CRS) AND EACH OF THE FILES (input and clip) ARE THE
SAME!
-If you want to be more accurate with your corners than a quick and dirty
hand digitised job then you can import the coordinates for the corners you
want using the 'XYtools" plugin to import spreadsheet files with xy
coordinate fields/columns; make a point file and then snap your polygon file
to the points when you create the polygon feature.
-You can also create a polygon with accurate coordinates for corners using
Python code here:
https://code.google.com/p/pyshp/

The second way is to run a SQL query on the attribute table (or manually
select the polygons you want to extract) for the polygons you want and then
:
1.  right click the filename in the layer list;
2.  click "Save as";
3.  name and locate file and choose CRS;
4.  click "OK".

This won't give you a rectangular extent (unless you have unusual data), but
will give you exactly the polygons you want.

To clip the raster you can use the Toolbox again:
"Geoalgorithms... Raster - vector... Raster - vector operations... Clip grid
with polygon"

YOU MUST HAVE SAGA INSTALLED ON YOUR MACHINE TO USE THIS TOOL (standard with
Osgeo4w install of QGIS)
You can also use the command line shell installed when you install FWTools
to run "gdal_translate" to clip rasters - 
Like so:
http://www.surfaces.co.il/clipping-a-raster-with-gdal/

"I repeat just want a specified area that easily can be determined by
longitude and latitude
coordinates."

Then use the spreadsheet import or python scripting approaches to create a
clipping polygon with the desired coordinates. Using the clip tools this is
simple as after you get your clipping polygon created.

Cheers,
Mike
____________________________
Qgis-user mailing list
Qgis-user at .osgeo
http://lists.osgeo.org/mailman/listinfo/qgis-user





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-get-rid-of-the-rest-of-the-World-tp5136462p5136667.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.



More information about the Qgis-user mailing list