Hi Shinn,
The trouble stems from the single call to:
line_data = gsn_add_polyline(wks, map_data, mrb_lon, mrb_lat, lnres)
which will treat all the coordinates in mrb_lot/mrb_lat as a
continuous line. You want to draw the line segments that make up the
countries individually, as in shapefile_3.ncl. In particular, you
want to replace the above call with something like:
segments = f->segments
geometry = f->geometry
segsDims = dimsizes(segments)
geomDims = dimsizes(geometry)
geom_segIndex = f@geom_segIndex
geom_numSegs = f@geom_numSegs
segs_xyzIndex = f@segs_xyzIndex
segs_numPnts = f@segs_numPnts
numFeatures = geomDims(0)
lines = new(segsDims(0),graphic) ; array to hold polylines
segNum = 0 ; Counter for adding polylines
do i=0, numFeatures-1
startSegment = geometry(i, geom_segIndex)
numSegments = geometry(i, geom_numSegs)
do seg=startSegment, startSegment+numSegments-1
startPT = segments(seg, segs_xyzIndex)
endPT = startPT + segments(seg, segs_numPnts) - 1
lines(segNum) = gsn_add_polyline(wks, map_data,
mrb_lon(startPT:endPT), \
mrb_lat(startPT:endPT), lnres)
segNum = segNum + 1
end do
end do
Check out the discussion at the top of the shapefiles page if the
above code doesn't make sense. Hope that helps...
Rick
On Dec 9, 2010, at 2:00 AM, shinn wong wrote:
> Dear all,
> I've tried to plot the outline boundary of some countries using data
> obtained from DIVA-GIS. The code and the output file can be seen in
> the attachment. However, the output is quite different from that of
> example 4 in the shapefile example page. Does anyone know how can i
> just plot the outline of the country like those in example 4 instead
> of all the data points? How can i get the coordinate of the outline
> of the country? Many thanks.
> Shinn
> <
> aa1
> .ncl
> >
> <
> shapefiles1.000001.png>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 9 09:12:25 2010
This archive was generated by hypermail 2.1.8 : Fri Dec 10 2010 - 14:58:12 MST