1

I have a sample of the address histories of households.

ID  ZIP1   ZIP2   ZIP3
01  XXXXX  XXXXX  XXXXX
02  XXXXX  XXXXX  XXXXX
03  XXXXX  XXXXX  XXXXX
04  XXXXX  XXXXX  XXXXX
...

It's easy enough for me to find the centroids of the ZIP codes. What I would like to do is link those centroids together to create an image showing household i's path from ZIP1 to ZIP2 to ZIP3.

Does anyone know any tools to make this easy in QGIS (or even better: R)? I have the feeling there must be some tool, but I don't know enough to think of what the name would be.

2
  • So basically you want to create polygons from points?
    – nickves
    Mar 28, 2013 at 20:52
  • Well, the object would be a polyline. Mar 29, 2013 at 14:27

1 Answer 1

2

First of all you should try to get geographical information for your zip-codes (geocode them). Without any real points you can't construct a polyline so therefore you should start with that.
With the help of R you can easily geocode a lot of addresses using web-services. See a little example here on my blog. Of course you might have to change the code to your needs and possibly also consult other geocoding services.
The resulting data.frame can be converted to a spatial-object (package sp - coordinates(data) = ~x+y) and then be saved to a shapefile (package rgdal - writeOGR(...) ).

As soon as you have your point layer grouped with a ID you can import it into QGIS and use the excellent plugins Points2One or Points to Path.

2
  • I figured a much easier way to get the spatial information would be by linking the ZIP code information to ZCTA TIGER files, which I already have. And my points are already geocoded anyways. The problem is that each point has multiple pairs of coordinates, and I need a way to map the links. Will look at Points to Path. Mar 31, 2013 at 1:31
  • The Points to Paths package worked for me. Apr 17, 2013 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.