[Qgis-user] Problems with Union tool in QGIS 2.6
Nicolas Cadieux
nicolas.cadieux at archeotec.ca
Fri Dec 5 12:00:59 PST 2014
Hi,
I have never used the join tool so I can't help you on the error. If the
tool worked before, I would first start with a complete reinstall of
Qgis removing your plugin folder (.qgis2 under users) and the registry
keys in Windows. (HKEY_CURRENT_USER/software/Qgis and QuantumGis if you
still have that. Then delete the Qgis program folder and do a complete
reinstall. I would use the OSGEO4W installer. If you have the Windows
Qgis installer, use the Windows unistaller then destroy all folder.
Make sure you backup the stuff you want to keep. Try the plugin again.
If you have problems, make a bug report.
Personally, I think you are probably looking at the problem from the
wrong point of view. I would look at it from a raster point of view and
not a vector point of view. It would be much faster. You can go back
and forth using the method used here.
http://fr.slideshare.net/shencoop/qgis-raster-to-point and you can use
the rasterize and polygonize tools and the vector research tools.
I would create raster masks for the water and ground data using the
raster calculator. Send me a typical ground data and I will see how I
can help figure this out.
If you decide to go at it the vectorial using my way using the point
sampling tool, this is what I would do (not knowing the union tool)
1: Add a row_number field in the VectorGrid.shp and generate the
row_number for your sampling grid. This new field will help you join
your point data to your VectorGrid.shp (Layer property/joins)
2: Extract your VectorGrid.shp Centroid (SamplingPoints.shp)
(vector/geometry tools...) ( and use the point sampling tool to get you
water vs land data. Don't forget to add the row_number from the
VectorGrid.shp
3: Join both files using the row_number field. If you have problems,
export SamplingPoints.shp to a csv and reimport using no x,y. You may
(or may not) have the same results if you only import the .dbf file.
4: Save the resulting Layer to VectorGrid_Land_Classe.shp Maker sure
your water vs land is reclassed to "1" and "2" in a new field.
5: Rasterize "VectorGrid_Land_Classe.shp" using the same raster extent
and grid size. Use extra variables in the GDALL script if needed
(yellow pencil) (see the help). You will end up with a raster
"results.tif" containing 1 (water) and 2 (land)
6: Polygonize "results.tif". You will have a new .shp with 2 object.
If you have Islands, you will have more.
Keep in mind that many of the tools only work with .shp files.... so
that may crash some tools if, for example, your data is in a .tab format.
Nicolas
Le 2014-12-05 13:53, Colin D. MacLeod [via OSGeo.org] a écrit :
> Thanks Nicholas,
> If I’m understanding it correctly (and I appologise if I’m not), te
> method you provide would allow me to elliminate any of my vector grid
> cells which fall on land (or more precisely which have centres that
> fall on land), which is useful. However, what I need to be able to do
> is to separate each grid cell which lies along any stretches of
> coastline into two separate irregular polygon features, one which
> falls entirely in the sea and one which falls entirely on land. I can
> then delete the sections of all the grid cells which fall on land.
> The process that I use for doing this is to use the Union tool to
> create a combined data layer of my land polygons and my polygon grid
> cells, and then use the ID field from the land polygon data layer to
> select and delete the sections which overlap with the land polygons,
> leaving me with a vector grid which is clipped exactly along the
> coastline, and has partial grid cells for these coastal cells that
> only represent the sea parts of them.
> As I said, this approach used to work perfectly in QGIS 2.2 and 2.4,
> but I can only get the Union tool to work intermittently in QGIS 2.6,
> and when it doesn’t work, I get the Feature Geometry Not Imported (OGR
> Error:) error message.
> At the moment, this is the one thing which is stopping me being able
> to ditch ArcGIS and instead use QGIS as the basis for teaching marine
> biologists to use GIS in their research using our standard protocols
> for processing data, so any suggestions on what might be going wrong
> with the Union tool, and how I might be able to deal with it, would be
> greatly appreciated.
> I would prefer to be able to use the Union tool in my exercises, but
> if there is another way of doing it that will allow me to split the
> coastal cells of my vector grid into irregular polygons that are
> entirely land and entirely sea, then I would consider that.
> Thanks for any further advice anyone can offer.
> All the best,
> Colin
> >>Hi, You can use the point sampling tool plugin for that. Extract
> your grid centroid, use the new point layers with the point >>sampling
> tools. You can also sample raster and vector values with the tool. You
> can rejoin both layer later in a number of ways. >>If you want to
> eliminate points, (or grid squares if both have been joined) you can
> use a query. If you have millions features, >>this may be slow. In
> that case, use the "split vector file" using a column. For more tools
> for your work, look at the plugins for >>"stats". You will find a
> number of good plugins for extracting statistics from vector or raster
> data. There are also many tools in >>the " processing" tools. Send me
> a mail if you need more help. I Like what you are doing... Nicolas
> Cadieux M.Sc. Les Entreprises >>Archéotec inc. 8548, rue Saint-Denis
> Montréal H2P 2H2 Téléphone: 514.381.5112 Fax: 514.381.4995 Le
> 2014-12-05 09:37, "Colin D. >>MacLeod [via OSGeo.org] "
> <ml-node+s1560n5176645h56 at n6.nabble.com
> <http://lists.osgeo.org/mailman/listinfo/qgis-user>> a écrit :
> ==================================================================================
> GIS IN ECOLOGY - Providing Training, Advice And Consultancy On The Use
> Of GIS In Ecology
>
> Web: www.GISinEcology.com Email: [hidden email]
> </user/SendEmail.jtp?type=node&node=5176687&i=0>
>
> Need to ask a question about using GIS? Try the GIS In Ecology Forum:
> www.GISinEcology.com/GIS_in_Ecology_forum.htm
>
> Books From GIS In Ecology Staff:
>
> An Introduction To Using GIS In Marine Biology; RRP: £44.99
> An Introduction To Using GIS In Marine Biology: Supplementary Workbook
> One - Creating Maps Of Species Distribution; RRP: £19:99
> An Introduction To Using GIS In Marine Biology: Supplementary Workbook
> Two - Working With Raster Data Layers; RRP: £19.99
>
> If you wish to purchase these books, visit:
> http://www.gisinecology.com/Book_Shop.htm
>
> To help the environment, please do not print out this email unless it
> is unavoidable.
> ==================================================================================
>
>
>
> ------------------------------------------------------------------------
> <http://www.avast.com/>
>
> This email is free from viruses and malware because avast! Antivirus
> <http://www.avast.com/> protection is active.
>
>
>
> _______________________________________________
> Qgis-user mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=5176687&i=1>
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://osgeo-org.1560.x6.nabble.com/Problems-with-Union-tool-in-QGIS-2-6-tp5176645p5176687.html
>
> To start a new topic under Quantum GIS - User, email
> ml-node+s1560n4125267h38 at n6.nabble.com
> To unsubscribe from Quantum GIS - User, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4125267&code=bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg==>.
> NAML
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problems-with-Union-tool-in-QGIS-2-6-tp5176645p5176697.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20141205/ad926b67/attachment.html>
More information about the Qgis-user
mailing list