I've use R to generate a matrix of points tagged to separate categories. Each point has a lat, long. and category. When I plot them in QGIS (using colored points of the appropriate size) it looks like a territory map - which is the application. The points cluster together in discernible market areas.

enter image description here

I would like to use R to generate shapefiles which follow the color boundaries and which contain the appropriate classification label. I would use those market boundary shapefiles in a variety of other applications.

The size of the matrix is 10000 x 10000.

  • 2
    you need to convert this grid of points (its a regularly spaced grid in some coordinate system, yes?) and then use a raster-to-vector process, eg raster::rasterToPolygons - might struggle on a 10k x 10k pixel raster unless you have lots of RAM though. Try it. – Spacedman Jan 12 at 18:59
  • 1
    Please decide which particular GIS software you wish to ask about in this particular question. Since @Spacedman has already suggested R may be fruitful I suggest you edit your question to focus on that. You can always ask about QGIS and Python in separate questions. – PolyGeo Jan 12 at 20:24
  • Edited to focus on R. – Rob Keefe Jan 13 at 3:34
  • Further clarification: the density of the matrix is 100 x 100. All of the "rasterize" commands I've reviewed have required numeric feature data (e.g. grayscale or elevations). This application is entirely categorical. – Rob Keefe Jan 14 at 14:03
  • If you just need to convert to polygons, I think you can assign numerical codes to each category (e.g. yellow=1, blue=2, etc.), convert to polygons and then label those polygons with the appropriate categories. This answer deals with a similar issue: stackoverflow.com/questions/35606557/… . Also, spex::polygonize is reasonably fast. – Jul Jan 15 at 7:52

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.