Content-Type: multipart/alternative; boundary="-679638972-431690014-1349735245=:7111" ---679638972-431690014-1349735245=:7111 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Well I've managed to find a little time between changing dirty nappies so p= lease find attached my first cut at a patch for shapelib=0Asupport in plmap= =0AI=E2=80=99ve made a few changes to plmap to do this:=0A=C2=A0=0AFirst is= the simple reading of the data from the shapefiles=0Arather than the origi= nal files. The .shp and .shx files are needed, none of the other shapefile = files are used. =C2=A0The shapelib files can be placed and=0Areferenced exa= ctly like the old files, so either in a =E2=80=9Cspecial place=E2=80=9D (da= ta=0Afolder, exe folder, etc) and referenced by filename or anywhere else r= eferenced=0Aby full path. Note that the extension can be omitted or include= d as per the=0Ashapelib API.=0A=C2=A0=0ASecond is the transformation is now= performed after the=0Awraparound fixing. This is because the transformatio= n may be into metres or=0Asome other such length unit if a map projection i= s used (I've just been working with data transformed onto a transverse merc= ator projection which does exactly this) making wraparound fixing impossibl= e after the transformation has been applied.=0A=C2=A0=0AThird is that wrapa= round fixing has been rewritten. This was=0Abecause the previous method bro= ke near the equator, particularly in Africa=0Awhere there are a number of l= ong straight political boundaries (so=0Apoint-to-point lon changes can be l= arge and lat can be small). It may be of=0Ainterest that the new method mea= ns that if the user specifies lon on 0-360=0Ascale, but the map is -180-180= (or visa-versa) then the features still plot=0Acorrectly.=0A=C2=A0=0AFrom = the previous discussions I=E2=80=99m sure there will be a=0Anumber of avid = testers. Example 19 uses plmap, but to run it=C2=A0you will need to get a r= eplacement=0Ashapefile map for the globe and usaglobe original maps. For te= sting I grabbed=0Athe 110 m resolution countries map from http://www.natura= learthdata.com/features/and made two copies of the .shp and .shx files, ren= aming them globe and=0Ausaglobe. Putting these in the same location as the = usual map files will give=0Ayou a functioning example 19.=0A=C2=A0=0AIf/whe= n people are happy with the patch I'll generate shapefile equivalents of th= e current maps which will mean that existing code will produce identical ou= tput whether or not PLplot has been compiled with shapelib support.=0A=C2= =A0=0AThe code currently plots polygons and ploylines only, and in both cas= es plots these as lines with no fill. I had wondered about adding the abili= ty to plot polygons with a fill, but this requires a change or addition to = the public API and I'm not sure how useful it would be - It would probably = need some way to link different fill syles to different objects within a fi= le and I think we already discussed that this is something it is best to le= t people code themselves rather than try to turn PLplot into GIS software. = Although if people think that it would be useful to have a fill option it's= relatively little effort to do - discus!!!=0A=C2=A0=0ALet me know if the p= atch works for you.=0A=C2=A0=0APhil=0A=0A =0A=0A___________________________= _____=0A From: Alan W. Irwin =0ATo: phil rosenbe= rg =0ACc: "plplot-devel@lists.sourceforge.net"= ; Andrew Ross =0ASent: Friday, 5 October 2012, 21:38=0ASubject: Re: [Plplot-de= vel] map resolution=0A =0ABy the way, I looked for a shapefile viewer on D= ebian and found=0Athuban. I don't know whether that is the best shapefile v= iewer for=0ALinux, but it is based on libgda/ogr.=C2=A0 When I tried thuban= on overall=0Ashapefile maps for British Columbian (obtained by following l= inks at=0Ahttp://downloads.cloudmade.com/) it appeared to work instantaneou= sly=0Aand well for the size (which totalled 200MB) of the 7 shapefile layer= s=0Amaking up the map of British Columbia that is provided by=0Ahttp://down= loads.cloudmade.com/.=C2=A0 Furthermore, I was much impressed=0Awith all th= e high-resolution local detail (e.g., coastlines, natural features,=0Apolit= ical boundaries to name three of the most useful shapefile layers=0Aavailab= le for the British Columbia map) that was available under the=0Athuban zoom= mode.=C2=A0 By the way, that zoom mode worked essentially=0Ainstantaneousl= y as well.=0A=0AI assume shapelib will be as fast or faster than libgda/ogr= so I think=0Awe have a lot to look forward to concerning the speed with wh= ich=0Ashapelib can deliver shapes behind the scenes to plmap for that=0Afun= ction to plot.=0A=0AAnd to anticipate a possible ( :-) ) further question f= rom Phil, no I=0Adon't think we should get into trying to let plmap deal wi= th several=0Ashapefile file layers at once. Instead it should be the users'= =0Aresponsibility to specify, e.g., "british_columbia_coastline.shp" as a= =0Afilename to plmap if they want the B.C. coastlines on their plot, and=0A= if a user wants another layer in their plot with natural features on=0Atop = of those coastlines, they can call plmap again with a different=0Afilename = for the same region, e.g., "british_columbia_natural.shp".=0A=0AAlan=0A____= ______________________=0AAlan W. Irwin=0A=0AAstronomical research affiliati= on with Department of Physics and Astronomy,=0AUniversity of Victoria (astr= owww.phys.uvic.ca).=0A=0AProgramming affiliations with the FreeEOS equation= -of-state=0Aimplementation for stellar interiors (freeeos.sf.net); the Time= =0AEphemerides project (timeephem.sf.net); PLplot scientific plotting=0Asof= tware package (plplot.sf.net); the libLASi project=0A(unifont.org/lasi); th= e Loads of Linux Links project (loll.sf.net);=0Aand the Linux Brochure Proj= ect (lbproject.sf.net).=0A__________________________=0A=0ALinux-powered Sci= ence=0A__________________________ ---679638972-431690014-1349735245=:7111 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
=0A=0A
Well I've managed to find a little time b= etween changing dirty nappies so please find attached my first cut at a pat= ch for shapelib=0Asupport in plmap
=0A=0A
I=E2=80=99ve made a few changes to plmap to= do this:
 
First is the simpl= e reading of the data from the shapefiles=0Arather than the original files.= The .shp and .shx files are needed, none of the other shapefile files are = used.  The shapelib files ca= n be placed and=0Areferenced exactly like the old files, so either in a =E2= =80=9Cspecial place=E2=80=9D (data=0Afolder, exe folder, etc) and reference= d by filename or anywhere else referenced=0Aby full path. Note that the ext= ension can be omitted or included as per the=0Ashapelib API.
 
Second is the transformation is now perfor= med after the=0Awraparound fixing. This is because the transformation may b= e into metres or=0Asome other such length unit if a map projection is used = (I've just been working with data transformed onto a transverse mercator pr= ojection which does exactly this) making wraparound fixing impossible after= the transformation has been applied.
 <= /div>
Third is that wraparound fixing has been rewritten. This was=0Abe= cause the previous method broke near the equator, particularly in Africa=0A= where there are a number of long straight political boundaries (so=0Apoint-= to-point lon changes can be large and lat can be small). It may be of=0Aint= erest that the new method means that if the user specifies lon on 0-360=0As= cale, but the map is -180-180 (or visa-versa) then the features still plot= =0Acorrectly.
 
From the previ= ous discussions I=E2=80=99m sure there will be a=0Anumber of avid testers. = Example 19 uses plmap, but to run it you will need to get a replacemen= t=0Ashapefile map for the globe and usaglobe original maps. For testing I g= rabbed=0Athe 110 m resolution countries map from http://www.natura= learthdata.com/features/=0Aand made two c= opies of the .shp and .shx files, renaming them globe and=0Ausaglobe. Putti= ng these in the same location as the usual map files will give=0Ayou a func= tioning example 19.
 
If/when people are happy with the patch I'll generate shapefile equ= ivalents of the current maps which will mean that existing code will produc= e identical output whether or not PLplot has been compiled with shapelib su= pport.
 
The code currently plots polygons and ploylines only, and in both cases plots these= as lines with no fill. I had wondered about adding the ability to plot pol= ygons with a fill, but this requires a change or addition to the public API= and I'm not sure how useful it would be - It would probably need some way = to link different fill syles to different objects within a file and I think= we already discussed that this is something it is best to let people code = themselves rather than try to turn PLplot into GIS software. Although if pe= ople think that it would be useful to have a fill option it's relatively li= ttle effort to do - discus!!!
 
Let m= e know if the patch works for you.
 
Phil
=0A=0A

From: Alan W. Irwin <irwin@beluga.phy= s.uvic.ca>
To: phil= rosenberg <philip_rosenberg@yahoo.com>
Cc: "plplot-devel@lists.sourceforge.net" <plplot= -devel@lists.sourceforge.net>; Andrew Ross <andrewross@users.sourcefo= rge.net>
Sent: Fri= day, 5 October 2012, 21:38
Subject: Re: [Plplot-devel] map resolution
<= /div>
By the way, I looked for a shapefile viewer on Debian and foundthuban. I don't know whether that is the best shapefile viewer for
Lin= ux, but it is based on libgda/ogr.  When I tried thuban on overall
= shapefile maps for British Columbian (obtained by following links at
http://downloads= .cloudmade.com/) it appeared to work instantaneously
and well for th= e size (which totalled 200MB) of the 7 shapefile layers
making up the ma= p of British Columbia that is provided by
http://downloads.cloudmade.com/.  = Furthermore, I was much impressed
with all the high-resolution local det= ail (e.g., coastlines, natural features,
political boundaries to name th= ree of the most useful shapefile layers
available for the British Columbia map) that was available under the
thuban zoom mode.  By t= he way, that zoom mode worked essentially
instantaneously as well.
I assume shapelib will be as fast or faster than libgda/ogr so I thinkwe have a lot to look forward to concerning the speed with which
shapel= ib can deliver shapes behind the scenes to plmap for that
function to pl= ot.

And to anticipate a possible ( :-) ) further question from Phil,= no I
don't think we should get into trying to let plmap deal with sever= al
shapefile file layers at once. Instead it should be the users'
res= ponsibility to specify, e.g., "british_columbia_coastline.shp" as a
file= name to plmap if they want the B.C. coastlines on their plot, and
if a u= ser wants another layer in their plot with natural features on
top of th= ose coastlines, they can call plmap again with a different
filename for = the same region, e.g., "british_columbia_natural.shp".

Alan
__________________________<= br>Alan W. Irwin

Astronomical research affiliation with Department o= f Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).=

Programming affiliations with the FreeEOS equation-of-state
impl= ementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides = project (timeephem.sf.net); PLplot scientific plotting
software package = (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Li= nux Links project (loll.sf.net);
and the Linux Brochure Project (lbproje= ct.sf.net).
__________________________

Linux-powered Science
_= _________________________


---679638972-431690014-1349735245=:7111--