[ncl-talk] SHAPE FILE PROBLEM

Rick Brownrigg brownrig at ucar.edu
Wed Nov 4 16:40:57 MST 2015


Hi,

It looks like you want to adjust your NDC coordinates for the legend. You
can add this call right before your call to draw:

 drawNDCGrid(wks)

It will help with determining appropriate NDC coords.  (You also have to
add this load command at the top:

  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

If you want nice left-justified labels within the legend columns, you could
add this resource:

   res at txJust = "LeftCenter"


All that said, you may not have enough room in the existing bottom margin
to plot your legend, in which case you'll want to push your map upwards on
the page;  see the examples at

  http://ncl.ucar.edu/Applications/viewport.shtml

for how to adjust the "viewport".

Finally, as for the black line, that's coming from NCL's map database. To
turn it off, I *think* its:


  res at mpOutlineOn = False

I hope that helps...
Rick




On Wed, Nov 4, 2015 at 2:57 PM, Jesús Garcia Rosales <jesus21gr at gmail.com>
wrote:

> Hi users,
> I have a problem with the position of my stations names and the map( look
> the image). Additionally I would like to eliminate the black line in the
> map and only visualize the shape file, I don't know how to do that. Please
> help me!, Thank for your time.
>
> My script is the next:
>
>
> ;**********************************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>   latN = -10.5
>   latS = -14.0
>   lonL  = -77.
>   lonR  = -73.
>
>   ; Coordenadas de cada estación que se quiere ubicar
>
>   lat=(/-12.04, -10.69, -11.4, -11.33, -12.25, -12.12, -11.4, -11.75,
> -11.88, -11.62, \
>         -11.78, -12, -12.16, -12.38, -12.35, -12.58, -12.78, -12.98,
> -13.06, -12.84/)
>
>   lon=(/-75.32, -76.26, -76.33, -76.4, -75.36, -75.43, -75.69, -75.13,
> -75.27, -75.01,\
>         -75.47, -75.22, -75.23, -74.85, -75.08, -75.24, -75.01, -74.72,
> -74.14, -74.57/)
>
>
>
>
>   wks = gsn_open_wks("x11","graficas/estaciones")
>
>   res                             = True
>   res at gsnFrame                    = False   ; So we can draw markers
>   res at gsnMaximize                 = True    ; affects ps, eps, pdf only
>   res at gsnPaperOrientation         = "portrait"  ; force portrait
>
>   res at tiMainString                = "Ubicacion de las estaciones"
>
>
>   res at mpMinLatF                   = latS     ; range to zoom in on
>   res at mpMaxLatF                   = latN
>   res at mpMinLonF                   = lonL
>   res at mpMaxLonF                   = lonR
>   res at mpCenterLonF                = (lonL+lonR)*0.5
>   res at mpBottomPointLatF           = 100
>
>
>   res at mpFillOn                    = False
>   res at mpOutlineDrawOrder          = "PostDraw"
>   res at mpFillDrawOrder             = "PreDraw"
>   res at mpOutlineBoundarySets       = "GeophysicalAndUSStates"
>   res at mpUSStateLineColor          = "White"       ;  "Gray10"
>   res at mpUSStateLineDashPattern    = 5
>   res at mpGridAndLimbOn = False
>
>
>   res at pmTickMarkDisplayMode       = "Always"
> ;
> ; Draw the map (frame won't get advanced because gsnFrame was set to
> False).
> ;
>   yres = True                            ; panel resource list
>   yres at gsnMaximize = True                ; maximize the plots
>   yres at gsnPaperOrientation  = "portrait" ; set paper orientation to
> portrait
>   yres at gsnPanelYWhiteSpacePercent = 5.0
>
>
>   map = gsn_csm_map(wks,res)
>
>
>
>  ;gsn_panel(wks,map,(/1,1/),yres)
> ; Draw markers on the plot in the lat/lon locations.
> ;
>   colors =
> (/"black","RoyalBlue","Yellow","antiquewhite3","darkolivegreen1","burlywood4",\
>
> "olivedrab","palevioletred","PaleGreen","Wheat","Brown","cadetblue","darkorchid",\
>
> "darkorchid4","deepskyblue3","forestgreen","chartreuse3","chartreuse","darkgoldenrod2","chocolate2"/)
>   labels = (/"Huayao","Cerro de
> Pasco","Marcapoma","Yantac","Laive","Jarpa","Tarma","Comas"\
>            ,"Ingenio","Ricran","Jauja","Santa
> Ana","Viques","Pampas","Pilchaca","Huancalpi"\
>             ,"Huancavelica","Lircay","Quinua","Acobamba"/)
>
> ; Manually specify location of legends
>
>   xleg =
> (/0.15,0.15,0.15,0.15,0.15,0.35,0.35,0.35,0.35,0.35,0.56,0.56,0.56,0.56,0.56,0.80,0.80,0.80,0.80,0.80/);
> Location of
>   xtxt =
> (/0.22,0.225,0.225,0.225,0.225,0.42,0.44,0.44,0.44,0.44,0.65,0.66,0.66,0.66,0.66,0.88,0.88,0.88,0.88,0.88/)
>  ; legend markers
>   yleg =
> (/0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08/)
>   ; and text
>   ytxt =
> (/0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08,0.20,0.17,0.14,0.11,0.08/)
>  ; strings.
>
>   mkres               = True
>   mkres at gsMarkerIndex = 17     ; Filled circle
>   mkres at gsMarkerSizeF = 0.06    ;0.03
>
>   txres               = True
>   txres at txFontHeightF = 0.013
>
>
>
>
> ; add location and text for each station
>
>   do i = 0,19
>      mkres at gsMarkerColor = colors(i)
>      gsn_polymarker(wks,map,lon(i),lat(i),mkres)
>      gsn_polymarker_ndc(wks,xleg(i),yleg(i),mkres)
>      gsn_text_ndc      (wks,labels(i),xtxt(i),ytxt(i),txres)
>   end do
>
>  ;Abriendo el archivo .shp
> cuenca_mantaro_shp_name = "/home/usuario/Escritorio/alan/cuencas/UH.shp"
>
>   lnres                  = True
>   lnres at gsLineColor      = "red"
>   lnres at gsLineThicknessF = 2
>
> can_id = gsn_add_shapefile_polylines(wks,map,cuenca_mantaro_shp_name,lnres)
>
>
>
>
>   draw(map)
>   frame(wks)
> end
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151104/528cdf11/attachment.html 


More information about the ncl-talk mailing list