[Qgis-user] spatialjoin

DelazJ delazj at gmail.com
Wed Dec 21 13:36:38 PST 2016


Hi,

2016-12-21 21:39 GMT+01:00 Karl-Magnus Jönsson <
Karl-Magnus.Jonsson at kristianstad.se>:

> Actually it is (easier). Or could be. If you are able to use spatial sql
> as in postgis. Maybe you could do something similar in spatialite. A little
> more work to set up the database but in the end there are a lot more
> possibilities. I would have done something like this (maybe not correct
> syntax. Read the referece!):
>
> Actually, for many releases now, you can use SQL on any file format in
QGIS, shapefile included. No more need to put it inside a SpatiaLite base.
Simply use virtual layer
http://docs.qgis.org/2.14/en/docs/user_manual/working_with_vector/virtual_layers.html
within the DB Manager tool.

Regards,
Harrissou

> Create or replace view [viewname] as
> Select
> A.id,
> A.attribute1,
> B.attribute2,
> A.geom
> From pointtable A, polygontable B
> Where st_within(A.geom,B.geom);
>
> If A.geom has to be transformed you could use st_transform inside the
> st_within function.
>
> /Karl-Magnus Jönsson
>
>
> 21 dec 2016 kl. 19:23 skrev Laurent Bourlet <laurentbourlet34 at gmail.com>:
>
> Hi,
>
> i thought it was more easy ...
>
> In fact , i don't use a GPS because these points don't need precision :
> they are only used to identify the parcels . And i would like to catch
> their identity ( a number for each parcel and the owner ) if possible with
> a dynamic spatialjoin...
>
> With booth data ( number of parcel and name of owner ) , i could talk with
> the fisc administration :-)
>
> Randy was right ...i didn't have the same EPSG for the two layers . It's
> now OK ! but without the feature "dynamic" .
>
> Indeed , i would avoid building many temporaries layers and i thought it
> existed a plugin for this  " dynamic" feature.
>
> If no , i will ask my users to make spatialjoins some time to time ...
>
> Waiting , i will try the solution of Bernd...
>
> Thank you anyway !
>
> laurent
>
>
> Le 21/12/2016 à 17:46, Bernd Vogelgesang a écrit :
>
> Hi,
>
>
> for me this sounds more like he is getting new points once in a while and
>
> wants to join those attributes to the new points "automatically" from the
>
> parcel layer.
>
>
> The biggest problem for users is to rethink the workflow from the end to
>
> the beginning and to know the limitations.
>
>
> The outcome should be a point layer with the polygons attributes. If those
>
> points (layer A) are from GPS as Randy assumes, they have to be
>
> reprojected to the parcels layer (layer B) before being able to join them
>
> spatially(layer C). The spatial join in the toolbox produces layer D.
>
>
> Most probably, the resulting layer D is going to to be edited in some way
>
> (adding notes about size, the progress, classifications, whatever), so you
>
> will have to find a way to preserve those new attribute while being able to
>
> add new points without much trouble.
>
>
> The processing toolbox is a good way to do these steps, though it produces
>
> a lot of temporary files cluttering the project.
>
>
> A better way for all those repetitive tasks, is to use the graphical
>
> modeller, to create a workflow which only has to be triggered once new
>
> points come in, and the resulting file can be saved as new a file e.g.
>
> with the current date in the name, so you have kind of an archive and do
> not
>
> overwrite previous files (and destroy your work in case something goes
>
> wrong).
>
>
> So I can imagine a model with input layer A (new points in WGS84 without
> attributes) and a parcel layer B (in whatever projection).
>
> reproject layer A and C will be created as an intermediate step.
>
>
> Next input layer is the latest result layer D, reprojected and with
> attributes.
>
> Merge layer C and D -> E. Now delete all columns which are from layer B
> (from the last spatial join. Unfortunately, you can only delete one field
> at a time in the modeller, so you'll will have to add the command several
> times in a row to the model) -> Fn
>
> Do the spatial join of Fn with B.
>
>
> The last result G will now hold all points with the corresponding parcel
> info plus additional fields you might have added to the points.
>
> G will be the input D in the next run with fresh points.
>
>
> So, do not add new points to the already existing collection of points in
> WGS84 (it is never save to edit layers without backup), but just import
> them as a new input set and then run the model with the parcel layer and
> the last result layer.
>
>
> The modeller is not as intuitive as it should be, but it can save you a
> lot of time once you managed to set up a model.
>
>
> Maybe I was completely wrong analysing the problem, but maybe someone else
> has the problem that fits to my solution ;)
>
> Cheers
>
> Bernd
>
>
>
>
>
>
> Am 21.12.2016, 14:07 Uhr, schrieb Randal Hale
>
> <rjhale at northrivergeographic.com>:
>
>
> 2 things:
>
>
> 1. In QGIS there is a processing toolbox (I assume you are one something
> as new as version 2.14.8). Open it (it's at the top -> Processing ->
> Toolbox). You can search for tools. Search for "join" and you should see a
> "Join Attributes by location". This is a spatial join.
>
>
> 2. THE MOST IMPORTANT THING. You mentioned you had collected points with a
> GPS. Possibly these points are in EPSG:4326. I'm going to guess that your
> parcel layer isn't. If you right click your parcel layer (in the layers
> panel) it will allow you to select properties. On the General Tab you will
> see the Coordinate Reference System mentioned and many times it is
> something like EPSG:xxxx . A Spatial Join must have the layers in the same
> coordinate system.
>
>
> If it is different - Right Click on your GPS points and "Save as". When
> the "Save vector layer as...." window comes up. Save it as a shapefile and
> MOST IMPORTANTLY change the CRS to match your parcel layer. Click on the
> small globe (that appears to be wearing a hat) and in the filter type in
> the number you see for your parcels. You can then select that projection
> and Save your file. It should save. You can then perform the "join by
> location".
>
>
> It should work. You are very close though so don't worry.
>
>
> Randy
>
>
>
>
> On 12/21/2016 01:24 AM, Erwan Conseil wrote:
>
> Hi
>
> In my layer B , I have the name of the owner and the number of the parcel
> : this number , a polygon , have a WKT location . All this is in a SHP . As
> I grab points in layer A directly in Qgis (2.18) , I have also a SHP . And
> i need a dynamic join because I have no desire to make the spatial join
> each time...
>
> Regards
>
> Laurent
>
>
> Le 21 déc. 2016 à 01:30, Randal Hale <rjhale at northrivergeographic.com> a
> écrit :
>
>
> In your layer B - Do the Names of the Owners have a location (like a tax
> parcel) or are they a spreadsheet (like Microsoft Excel)?
>
>
> Randy
>
>
>
> On 12/20/2016 06:03 PM, Laurent Bourlet wrote:
>
> Hi at all
>
>
> I'm a beginner in Qgis and i would make a dynamic spatialjoin.
>
> In fact , i have created a vector layer ( for example  A) and i grab
> points in it when I'm outdoor ( these points are buildings unknowned by the
> government and so these building are not taxed ...) . I have also a layer
> (B) with the name of the owners of these lands .
>
> You see what i would ?...
>
> I would have these names transferred as attribut from B to A .
>
> For that , i think about a spatialjoin with a dynamic feature . So i have
> downloaded the two plugins "reffunction" and "spatialjoin".
>
> But i have certainly maked something wrong because i don't succeed ...
>
>
> Is it the good method ?
>
>
> And If yes , and if exist a doc about these plugins ...i'll take it :-))
>
>
> regards
>
>
> Laurent
>
>
> ( pour les francophones ...je repère et saisis des points représentants
>  des batiments construits et visibles par Google Map mais inconnus par le
> cadastre et donc les impôts ...je voudrais donc enrichir la couche de
> saisie par les références des parcelles et les noms des propriétaires par
> une jointure spatiale dynamique ..à chaque point saisi , "monte" cette
> référence )
>
>
> _______________________________________________
>
> Qgis-user mailing list
>
> Qgis-user at lists.osgeo.org
>
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> -- -----------------
>
> Randal Hale
>
> North River Geographic Systems, Inc
>
> http://www.northrivergeographic.com
>
> 423.653.3611 rjhale at northrivergeographic.com
>
> twitter:rjhale
>
>
> _______________________________________________
>
> Qgis-user mailing list
>
> Qgis-user at lists.osgeo.org
>
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20161221/2feaebf6/attachment.html>


More information about the Qgis-user mailing list