The joy of windows - there is no standard directory, in the source tree the shapefil.h header is in the top level. I always create a librarytopleveldir/include/libraryname folder for headers and add the include MAKE at all so is there any chance you could create a #define SHAPELIB_INCLUDE_DIR based on the variable.
2) plplotd needs to be linked with the shp library. To achieve this I
added the following code to src/CMakeLists.txt
Does plplotd link with the other libraries used by plplot? Thisbehaviour doesn't occur on my Windows system and I have to link my final code against the other dependancies myself. Do you want to commit this change yourself or shall I include it in my patch?
3) The code generated the following gcc warning
/home/andrew/software/plplot/plplot/src/plmap.c:48:1: warning: 'visibility' attribute ignored [-Wattributes]
The problem here is the static attribute. This makes the scope of the
variable local to this file, and hence visibility attributes don't make
sense. I'm guessing this is not what you wanted. Looks like this bit of
code was just copied from src/plctrl.c. The plplotLibDir
is only actually used by the tcl code to pass the tcl library directory.
I would just remove all references to this here.
Good spot, I didn't get the warning. I wasn't sure about the use of plplotLibDir so was just trying to preserve it. I will remove references to it.
- Having made these changes the code compiled and example 19 ran. I tried
this _before_ downloading any shapefiles. As it stands your patch doesn't
fall back to using the old map code. I'd suggest a fallback would be
sensible for compatibility. One might want to use shapefiles and
old plplot maps (at least for now). At least it needs an error message if
the file can't be found!
My fallback strategy will be to create a globe.shp, etc based on the contents of globe.map I was just waiting for the code to be tested before I did it. I think this is the "method of least surprise." If a user selects to use shapefiles then they should use shapefiles easch time.
- The function OpenShapeFile still contains mentions of plLibOpenPdfstr.
Yeah, I was just trying to keep as much old code as possible, but I agree there can be more shared code this way, I'll change it
- I've had a quick look at the transform code. Making multiple copies of
the data seems like a slightly inefficient way of solving the problem. I
wonder if there is a better algorithm for fixing the problem? I would
suggest creating a simple example to illustrate the problem (maybe a
new page for example 19). This way we would have a test case try out
It might be inefficient, but I would guess (and it is a guess without profiling)
that the time to make multiple copies is less than the time to read the data from the hard drive. I could instead reuse the same data, but would need to itterate over it 5 times, which I'm not sure would be much quicker.
The method that was there before, plain didn't work, neither did the method that it had replaced that was commented out. This method should be as general as possible so should work with any shapefile (with units of degrees lat/ lon) which is important if users might try their own shapefiles. I can certainly implement another algorithm if you have any suggestions.
Once I downloaded the shapefiles following your pointer to
www.naturalearthdata.com (great site by the way!) all worked fine so
these comments are mostly stylistic in nature.
On Mon, Oct 08, 2012 at 03:27:25PM -0700,
phil rosenberg wrote:
> Well I've managed to find a little time between changing dirty nappies so please find attached my first cut at a patch for shapelib
> support in plmap
> I???ve made a few changes to plmap to do this:
> First is the simple reading of the data from the shapefiles
> rather than the original files. The .shp and .shx files are needed, none of the other shapefile files are used. ??The shapelib files can be placed and
> referenced exactly like the old files, so either in a ???special place??? (data
> folder, exe folder, etc) and referenced by filename or anywhere else referenced
> by full path. Note that the extension can be omitted or included as per the
> shapelib API.
> Second is the transformation is now performed after the
> wraparound fixing. This is because the transformation may be into metres or
> some other such length unit if a map
projection is used (I've just been working with data transformed onto a transverse mercator projection which does exactly this) making wraparound fixing impossible after the transformation has been applied.
> Third is that wraparound fixing has been rewritten. This was
> because the previous method broke near the equator, particularly in Africa
> where there are a number of long straight political boundaries (so
> point-to-point lon changes can be large and lat can be small). It may be of
> interest that the new method means that if the user specifies lon on 0-360
> scale, but the map is -180-180 (or visa-versa) then the features still plot
> From the previous discussions I???m sure there will be a
> number of avid testers. Example 19 uses plmap, but to run it??you will need to get a replacement
> shapefile map for the globe and usaglobe original maps. For
testing I grabbed
> the 110 m resolution countries map from http://www.naturalearthdata.com/features/and
made two copies of the .shp and .shx files, renaming them globe and
> usaglobe. Putting these in the same location as the usual map files will give
> you a functioning example 19.
> If/when people are happy with the patch I'll generate shapefile equivalents of the current maps which will mean that existing code will produce identical output whether or not PLplot has been compiled with shapelib support.
> 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 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 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 people think that it would be useful to have a fill option it's relatively little effort to do - discus!!!
> Let me know if the patch works for you.
> From: Alan W. Irwin <firstname.lastname@example.org
> To: phil rosenberg <email@example.com
> Cc: "firstname.lastname@example.org
>; Andrew Ross <email@example.com
> Sent: Friday, 5 October 2012, 21:38
> Subject: Re: [Plplot-devel] map resolution
> By the way, I looked for a shapefile viewer on Debian and found
> thuban. I don't know whether that is the best shapefile viewer for
> Linux, but it is based on libgda/ogr.?? When I tried thuban on overall
> shapefile maps for British Columbian (obtained by following links at
) it appeared to work instantaneously
> and well for the size (which totalled 200MB) of the 7 shapefile layers
> making up the map of
British Columbia that is provided by
.?? Furthermore, I was much impressed
> with all the high-resolution local detail (e.g., coastlines, natural features,
> political boundaries to name three of the most useful shapefile layers
> available for the British Columbia map) that was available under the
> thuban zoom mode.?? By the way, that zoom mode worked essentially
> instantaneously as well.
> I assume shapelib will be as fast or faster than libgda/ogr so I think
> we have a lot to look forward to concerning the speed with which
> shapelib can deliver shapes behind the scenes to plmap for that
> function to plot.
> And to anticipate a possible ( :-) ) further question from Phil, no I
> don't think we should get into trying to let plmap deal with several
file layers at once. Instead it should be the users'
> responsibility to specify, e.g., "british_columbia_coastline.shp" as a
> filename to plmap if they want the B.C. coastlines on their plot, and
> if a user wants another layer in their plot with natural features on
> top of those coastlines, they can call plmap again with a different
> filename for the same region, e.g., "british_columbia_natural.shp".
> Alan W. Irwin
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
> Programming affiliations with the FreeEOS equation-of-state
> implementation 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 Linux Links project (loll.sf.net);
> and the Linux Brochure Project (lbproject.sf.net).
> Linux-powered Science
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> Plplot-devel mailing list