Error plotting polyline entities from a shapefile [message #94732] |
Wed, 20 September 2017 06:49  |
Burch
Messages: 28 Registered: December 2013
|
Junior Member |
|
|
IDL is generating an error when I try to plot the polyline entities within a shapefile using function graphics.
First, I initialize the map and display a shapefile with polygon entities. (The shapefiles I'm using are from
http://strimaps.si.edu/portal/home/item.html?id=21a630266ea5 4da39cb368afe755f6af
One is in the BaseMap layer and the other is in the BCI Trails layer.)
outlineShapeFile = '[path_to_directory]/BaseMap/BCNM_land.shp'
trailsShapeFile = '[path_to_directory]/BCI_Trails/BCI_Trails.shp'
basemap = map('Transverse Mercator', $
ellipsoid='WGS 84', $
false_easting = 500000d, $
false_northing = 0.0, $
center_longitude = -81.0, $
limit = [9.12, -79.89, 9.19, -79.81], $
fill_color ="light_blue", $
/box_axes)
outline = mapContinents(outlineShapeFile, $
fill_color = 'pale goldenrod',$
/noclip)
Naturally, I attempt to display the polyline entities:
trails = mapContinents(trailsShapeFile, /noclip)
This generates the following error:
% Subscripts are not allowed with variable attributes.
I played around with the call to MAPCONTINENTS() for a while and didn't get anywhere. Note that removing /noclip gets rid of the error but nothing is plotted. Anyway, I decided to go about it a bit more manually and make the plot using IDLFFSHAPE() and POLYLINE():
trailsShape = idlFFShape(trailsShapeFile)
trailsShape.getProperty, n_ent = nEnt
trailsEnt = trailsShape.getEntity(/all)
for i=0, nEnt - 1 do begin
trVerts = *trailsEnt[i].vertices
x = trVerts[0,*].reform()
y = trVerts[1,*].reform()
void = polyline( x, y, /data)
endfor
And...
% POLYLINE: Subscripts are not allowed with variable attributes.
Well, that's unfortunate. I'm beginning to suspect a bug. Or maybe an unintended consequence. Has anyone dealt with this before? Is there something I'm missing?
In the meantime, I'm working around the error by using POLYGON() to, in effect, draw each line twice:
trailsShape = idlFFShape(trailsShapeFile)
trailsShape.getProperty, n_ent = nEnt
trailsEnt = trailsShape.getEntity(/all)
for i=0, nEnt - 1 do begin
trVerts = *trailsEnt[i].vertices
x = trVerts[0,*].reform()
y = trVerts[1,*].reform()
void = polygon( [x, reverse(x)], [y, reverse(y)], /data)
endfor
And finally
IDL> !version
{
"ARCH": "x86_64",
"OS": "darwin",
"OS_FAMILY": "unix",
"OS_NAME": "Mac OS X",
"RELEASE": "8.5",
"BUILD_DATE": "Jul 7 2015",
"MEMORY_BITS": 64,
"FILE_OFFSET_BITS": 64
}
P.S. I'm having difficulties connecting (i.e., I can't connect) to Harris' website to submit a bug report.
-Jeff
|
|
|
Re: Error plotting polyline entities from a shapefile [message #94735 is a reply to message #94732] |
Wed, 20 September 2017 08:24  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Wednesday, September 20, 2017 at 9:49:28 AM UTC-4, Jeff B wrote:
> P.S. I'm having difficulties connecting (i.e., I can't connect) to Harris' website to submit a bug report.
>
> -Jeff
On their Facebook page, Harris Geospatial has a note:
"Our website is currently undergoing maintenance, we apologize for any inconvenience!"
|
|
|