2

I am looking for a method to partition map in 3 groups (North, Centre, South) like this: enter image description here how to do this in R please

stations.txt

Code :

Al <- shapefile("DZA_adm/DZA_adm0.shp")

# read in ascii file, and assign column names
x <- read.table('E:/cluster/stations.txt', sep=";")
names(x) <- c('long', 'lat')

# subset original object, return only x,y cols
y <- data.frame(x[,1:2])
#coordinates(y) <- ~long + lat
# simple plot of x,y data
plot(y, pch=4)
plot(Al,add=TRUE)

Partition the map above I done manually, looking for a way to do this automatically ,Which (modified) clustering algorithm will be appropriated for such task? (I work with R)?

  • 2
    Could you please edit your question to include more details? 1. What is a card? 2. How did you arrive at the map you posted? 3? What have you tried so far? – Fezter Dec 3 '14 at 4:15
1

As you try to cluster your points by latitude you can explicitly divide them (to subsets or just add an attribute) depending on the value of the latitude.

Assuming coprdinates are in Lat and Lon columns

stations['clustres'] <- NA
stations$clusters [stations$Lat > n] <- 'North' 
stations$clusters [n > stations$Lat >= n1] <- 'Center'
stations$clusters [n1 < stations$Lat] <- 'South'

This will get your points assigned to clusters.

If you really need it you can create convex hulls or alfa-convex hulls (CRAN package). Though there could be gaps or overlaps between polygons after this.

I highly doubt that there is clustering procedure available to divide your points and щгедшту еруь the way you draw it.

Your Answer

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

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