I am currently using the Shape Diameter Function on CGAL to extract the diameter of an .off file. The function outputs a segment id for each facet in the mesh, and I would like to find the location of each facet in a 3d space so I can pair each facet with its corresponding segment-id. Is this possible?
Thanks,
Sharan
According to the documentation, the parameter SegmentPropertyMap is exactly what you need.
If you look at this example, it is done in the last 6 lines of code.
Related
Along a known line, I am trying to extract a list of point at set distances from the end of the line. e.g. 30cm and 65cm from the end of the line.
I have been exploring ezdxf but haven't found a simple function to achieve this.
Diagram: Known points in blue, required positions marked in red
I need to draw a graph like this:
I have used plotArrays two times(1.to get curves on the left, 2.to get curves on the right) to get the curves on in two separate plot-windows.
plotArrays(x_neg,SOC_neg,legend=names,id=1);
plotArrays(x_pos,SOC_pos,legend=names,id=2);
The middle region is empty. If I use single plotArrays function combining these data, the ends will automatically connect with each other which I don't want to do.
How can I plot it in single command?
Thank you
Use multiple calls to the function plotArray with the same id and erase=false.
I have some data about the height of a set of points (for example, from the Google Elevation API). There is a task to save this data in GeoTIFF format, then to use in osgEarth (GDAL). How can this be done? It does not matter in what language.
A quick search on the Internet only gave me the answer to the reverse question (How do I open geotiff images with gdal in python?)
I would be very grateful for any help.
So i would do this with GDAL from python (You could also use rasterio which is a nice wrapper around gdal for file raster file handling)
You should put your data in a numpy array,let us call it some_nparray.
Then create the tif dataset gtiffDriver.Create(). Here you can provide the name of your file, the dimensions in number of columns and rows of your image, the number of bands (here 1), and the datatype. Here i said float32, however byte, int16 etc could also work, depending on your data (you can check it with heigh_data_array.dtype)
Next you should set the geotransform, which is the information about the corner coordinates and pixel resolution, and you should set the projection you are using. This is done with dataset.SetGeoTransform and dataset.SetProjection. How these are created is not in the scope of this question I believe. If you do not need it, i guess you can even skip that part.
Finally write your array to the file with WriteArray and close the file.
You code should look something like this. Here I use the convention that variables prefixed with some_ should be provided by you.
from osgeo import gdal
height_data_array = some_nparray
gtiffDriver = gdal.GetDriverByName('GTiff')
dataset = gtiffDriver.Create('result.tif',
height_data_array.shape[1],
height_data_array.shape[0],
1,
gdal.GDT_Float32)
dataset.SetGeoTransform(some_geotrans)
dataset.SetProjection(some_projection)
dataset.GetRasterBand(1).WriteArray(height_data_array)
dataset = None
I am trying to extract information at a specific location (lat,lon) from different satellite images. These images are were given to me in the AREA format and I cooked up a simple jython script to extract temperature values like so.
While the script works, here is small snippet from it that prints out the data value at a point.
from edu.wisc.ssec.mcidas import AreaFile as af
url="adde://localhost/imagedata?&PORT=8113&COMPRESS=gzip&USER=idv&PROJ=0& VERSION=1&DEBUG=false&TRACE=0&GROUP=FL&DESCRIPTOR=8712C574&BAND=2&LATLON=29.7276 -85.0274 E&PLACE=ULEFT&SIZE=1 1&UNIT=TEMP&MAG=1 1&SPAC=4&NAV=X&AUX=YES&DOC=X&DAY=2012002 2012002&TIME=&POS=0&TRACK=0"
a=af(url);
value=a.getData();
print value
array([[I, [array([I, [array('i', [2826, 2833, 2841, 2853])])])
So what does this mean?
Please excuse me if the question seems trivial, while I am comfortable with python I am really new to dealing with scientific data.
Note
Here is a link to the entire script.
After asking around, I found out that the Area objects returns data in multiples of four. So the very first value is what I am looking for.
Grabbing the value is as simple as :
ar[0][0][0]
Does anyone know if the method getFontSize in TextPosition always returns one and should I only use getFontSizeInPt to get the size of the font?
The problem I have is that getFontSizeInPt sometimes returns different values for the same sized text (I got 12 and 11 return for text in the same paragraph with the same size.
Does anyone know if the method getFontSize in TextPosition always returns one
It does not always return one.
Please be aware that in the PDF page content descriptions there are several settings which all influence the final text size:
the font size parameter of the font selecting operator Tf:
the text matrix set by the operator Tm;
the current transformation matrix set by the operator cm;
the UserUnit setting of the PDF page.
The final text size is the first value scaled by the text matrix, scaled again by the transformation matrix, and scaled once more by the user unit value.
(Actually there even are some more factors. E.g. if one uses rendering mode 2, fill & stroke, for a faux bold effect, this slightly increases the size, too.)
TextPosition.getFontSize returns the first value only.
TextPosition.getFontSizeInPt returns something like the first value scaled by the matrices. (something like because at first glance there seems to be another influence in it.)
Different PDF creators use these influences in different ways:
Some PDF creators use only the first value to set the font size and use the matrices only for operations not changing the effective font size, e.g. rotations.
Some PDF creators set the first value to 1 and scale using the matrices.
Some PDF creators fall inbetween and use both the first value and the scaling operations.
Thus, your PDFs seem to be created by software using the second way.
getFontSizeInPt sometimes returns different values for the same sized text (I got 12 and 11 return for text in the same paragraph with the same size.
Could you share a sample PDF with that issue? As mentioned above, at first glance there seem to be additional influences which might be incorrect. But there also might be something special about your PDF.