GIS / Mapping Working Group

Public Group active 6 days, 13 hours ago

Spatial Join advice

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #73980
    David Topel
    Member

    Hi Everyone, Im not sure the forum is for individual requests of help, and if that is the case just let me know and I apologize in advance. In any case, I am asking for help and advice and I don’t know where else to ask or read by now.

    I wanted to ask if Olivia or Javier or anyone in the group could help me with a very frustrating issue on data management for my dissertation dataset:

    I am trying to join points (crime events) to a shapefile with city-blocks (polygons) of some Latin American in different countries (by IRB instructions some of the cities in my sample can’t be named, but you’ll notice) if you see it, especially Javier ;-)).

    So: in one of the cities I lose many of the points. They don’t join to the blocks (polygons). The polygons are separated as they have streets (polylines), and ‘splinters’ (errors) due to bad digitalization process. The polygons representing the city-blocks are very important because they contain a bunch of aggregated socio-economic data that will be precisely the quid of my dissertation. I should also add that many of the points fall out of the polygons in these streets, splinters, but I want to join them to the nearest polygon. These are the ones not being joined.

    So far nothing works, not with intersect join, or closest, or closest geodesic or any other type of match. I have to do this constantly as Im still getting data, and I will also join points of infrastructure like banks, churches, malls and schools.

    But be through a workshop or in person: can somebody please help me with this? This is not even central to my analysis, just the data management and Im totally stuck after days trying with ArcMap and Qgis.

    My emails are dtopel@gradcenter.cuny.edu and djtopel2000@gmail.com and my phone is 201-706-1589.

    Thanks in advance for any help,

    David Topel Mujica

    #74041
    Frank Donnelly
    Participant

    Hello David,

    In this case it sounds like you have some bad polygon geometry. If you have polygons that are not properly enclosed they’re saved as line segments that lack area. An intersection between points and this layer will yield no result, as the points have no area they can fall within.

    In QGIS you can try running Vector – Geometry Tools – Check Validity on the layer to see how many problems there are. In the Processing toolbox under Vector geometry there is a fix geometry tool that can fix small errors but it can be hit and miss. ArcGIS has similar tools. I’ve had the best success fixing geometry using PostGIS.

    Other possible problems would include: trying to do an intersection between points and polys where you’ve plotted points but haven’t converted them to a layer (shapefile or geopackage) prior to running intersection, or a mismatch in coordinate systems between the point and poly layer. But if you are only having problems with your one city layer and the others work fine, it’s likely a geometry problem.

    This semester my GIS Lab at Baruch is open Wed-Thu-Fri. Hours and contact info are posted below. I am *not* in the office this week (Feb 18-22), but my lab assistant is in this Thu-Fri.

    https://www.baruch.cuny.edu/confluence/display/geoportal/GIS+Lab

    Best – Frank

    #74067
    Javier Otero Peña
    Participant

    Hi David!

    There’s something that might be able to work out for you, once you’ve checked the validity of the polygons. Have you tried the QGIS plugin called NNJoin? It lets you join two layers based on nearest neighbor.

    With this plugin, you could join points to a polygon layer, although the caveat is that I think it will only take data from one point, not sure if it aggregates numeric data. The alternative is to do the opposite: join polygons using NNJoin to the points, so each point will have the data of the nearest city-polygon. Then you can aggregate the data yourself and using the unique key attribute of the city-polygons (name, or id number) you can then do a regular spatial join of the points to city-polygons, based on that key attribute.

    Besides the GIS Lab that Frank mentioned above, you can also come to GC Digital Fellows Office Hours, the schedule is here.

    I’ll be there next Monday 27 February, 3-5pm, would be happy to talk about your project there in person.

    Best,

    Javier

    #74126

    Hi David,

    Just checking in to see how things went… were you able to come up with a solution?

    Best,

    Lisa

    #74224
    David Topel
    Member

    Thank you Lisa for following up, and Javier and Frank.

    I have done it the way Javier explained, joined polygons to points and then used the unique ID to rejoin to the polygons. The features Frank identifies are true also, so thank you, but I still can’t repair them yet. The add-on NNjoin is something I didnt try yet. For the workaround Javier described, I didn’t need apparently to repair the geometry. Im still interested in doing that, so I will email Frank aside to go to his lab at the time of his convenience and show them all the layers I joined and the ones I am still working on to do future joins.
    My idea is to finish a dataset complete enough that I can export to Stata where I am more comfortable.

    Thank you again for your support and advice!

    david

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.