Help with assigning point to vector polygons
Duc Nygen
duc at comsearch.com
Tue Feb 23 17:49:21 EST 1993
Dear grassp's:
I have a simple problem that some of the 'guru' grassers out there can help. I
have an ascii vector file which contains all areas (A nnn) where I need to assign
label whose content keeps information which I need to use to analyse among the maps.
An example is:
RGANIZATION: Comsearch
DIGIT DATE: 09/09/92
DIGIT NAME: 48113
MAP NAME: fixed up
MAP DATE: 338 15538
OTHER INFO: modified by duc kim nguyen
MAP SCALE: 24000
ZONE: 0
WEST EDGE: -126.0
EAST EDGE: -66.0
SOUTH EDGE: 24.0
NORTH EDGE: 49.5
MAP THRESH: 0.0
VERTI:
A 57 358562 "0112 "
32.6417007 -96.8059006
32.6417007 -96.8060989
32.6417007 -96.8084030
32.6416016 -96.8140030
32.6413994 -96.8210983
32.6413002 -96.8226013
32.6413002 -96.8227997
32.6517982 -96.8227997
32.6637993 -96.8225021
32.6739006 -96.8224030
32.6743011 -96.8224030
32.6795998 -96.8224030
32.6860008 -96.8221970
32.6865997 -96.8221970
32.6865997 -96.8220978
32.6865005 -96.8217010
32.6864014 -96.8214035
32.6861992 -96.8209991
32.6861000 -96.8209000
32.6856003 -96.8201981
32.6853981 -96.8197021
32.6846008 -96.8183975
32.6839981 -96.8175964
32.6837006 -96.8170013
32.6834984 -96.8163986
32.6833992 -96.8158035
32.6832008 -96.8151016
32.6832008 -96.8143005
32.6832008 -96.8136978
32.6832008 -96.8134995
32.6833000 -96.8127975
32.6833992 -96.8121033
32.6833992 -96.8115997
32.6834984 -96.8113022
32.6834984 -96.8105011
32.6834984 -96.8100967
32.6833000 -96.8096008
32.6832008 -96.8093033
32.6828003 -96.8087006
32.6824989 -96.8080978
32.6822014 -96.8077011
32.6819992 -96.8072968
32.6817017 -96.8068008
32.6815987 -96.8059006
32.6815987 -96.8052979
32.6815987 -96.8049011
32.6817017 -96.8041992
32.6818008 -96.8039017
32.6814995 -96.8040009
32.6814003 -96.8041992
32.6806984 -96.8046036
32.6803017 -96.8049011
32.6803017 -96.8050995
32.6800003 -96.8051987
32.6800995 -96.8057022
32.6430016 -96.8059006
32.6417007 -96.8059006
now I need to read this file and generate a label and attribute files such as:
A -96.8133507000 32.663949950 358562
and
# 358562 categories
MAP NAME: fixed up
0.0 0.0 0.0 0.0
358562: info(3402,1113,34537,2.8,63,531 "0112 ")
and the algorithm I used to generate the point is a simple one: find its maximum
vertices, and compute the mid-point; then use the dig_point_in_poly to see if it is in
otherwise find the most western point and its neighbours to triangulate:
*
/|
/ |<--- point chosen
/ |
*---*
it seems that these two strategies are good enuf, however when v.support sometimes tells
me that some of the points are NOT in:
PNT_TO_AREA failed: (-96.8133507, 32.663949) (Category 358562)
What got me is that the same code in mapdev to do the point_in_poly is used in mine to
determine whether such point is valid (my code it is, grass says it's not). The other
question is whether grass has already such capability in some programs which I can use
to automagically have them assigned / generated with category number.
Any way, I wrote an X program to display the polygon and point chosen and found that the
points that grass say PNT_TO_AREA failed are perfectly in the middle of the polygon (??!).
Any help is appreciated.
cheers
duc at comsearch.com
More information about the grass-dev
mailing list