Hello I am using GMapsFX for my JavaFX application. I am getting longtitude and latitute from Google Maps with the API but I would like to get GGRS87 also.
In Greek it is called EGSA87. Ι have searched for that and found nothing so far. There might be a solution on the libraries of Geotools or proj4j but I don't have very good knowledge of java and especially I can't find the solutions in so big libraries like those.
I have found many sites to make calculations but how can I make a mathematical calculation myself? Or even a library to solve this problem?
You can use the GDAL library for it, but its setup is actually quite complicated. You would have to install GDAL on your system (it is in Debian packages) and then build the Java JNI bindings for it [1]. [2] is also quite useful in getting it to work.
Then, you could use the Java GDAL library:
<dependency>
<groupId>org.gdal</groupId>
<artifactId>gdal</artifactId>
</dependency>
and do something like:
final SpatialReference source = new SpatialReference();
source.ImportFromEPSG(4326); // EPSG code for WGS84, see www.epsg.io
final SpatialReference target = new SpatialReference();
target.ImportFromEPSG(4121); // EPSG code for GGRS87, see www.epsg.io
this.coordinateTransform = CoordinateTransformation.CreateCoordinateTransformation(source, target);
final Geometry geometry = ogr.CreateGeometryFromWkt(String.format("POINT (%f %f)", longitude, latitude));
geometry.Transform(coordinateTransform);
final double ggrsX = geometry.GetX();
final double ggrsY = geometry.GetY();
[1] https://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix
[2] http://geoexamples.blogspot.com/2012/05/running-gdal-java.html
Related
Is there a way to transform a EPSG:3857 projection to EPSG:4326 in java? I'm using the esri java sdk. I went through the esri skd docs, but couldn't find a way to transform EPSG:3857 to EPSG:4326. Is there a way of doing it?
I have a webMercator like this: Point property = new Point(1.7040237624799997e7,-3099509.4953500014, SpatialReferences.getWebMercator());
And have a WSG84 like this Point point1 = new Point(153.089361, -26.802295, SpatialReferences.getWgs84());
I need to merge them and as those points have different Spatial References I can't display a map property.
I'm assuming you are using the ArcObjects SDK for Java? Then the following code should work because your Point class is implementing the IGeometry interface according to esri java doc
https://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/geometry/IGeometry.html
Point property = new Point(1.7040237624799997e7,-3099509.4953500014,
spatialReferences.getWebMercator());
Point reprojected = property.project(SpatialReferences.getWgs84());
Because your Point constructor looks like you're using one of the newer Esri SDKs like ArcGIS Pro SDK or Runtime SDK I'm adding a solution for them too:
Point originalPoint = new Point(1.7040237624799997e7,-3099509.4953500014,
spatialReferences.getWebMercator());
Point projectedPoint = (Point) GeometryEngine.project(originalPoint,
SpatialReference.create(4326));
according to
https://developers.arcgis.com/java/latest/sample-code/project.htm
For my App I need compact code for converting between LatLon (WGS84) and MGRS.
JCoord.jar:
Looks great, but the version 1.1 jar is 0.5Mb in size. That is doubles my App for only perfoming a 2-way conversion of coordinates.
Openmap:
Isolating just the MGRSPoint.java (https://code.google.com/p/openmap/source/browse/src/openmap/com/bbn/openmap/proj/coords/MGRSPoint.java) from the rest is not easy.
GeographicLib:
This seems a good solution, but I could not find a Java source file.
Is it available for usage?
Nasa:
The Nasa code looks great, see http://worldwind31.arc.nasa.gov/svn/trunk/WorldWind/src/gov/nasa/worldwind/geom/coords/MGRSCoordConverter.java. Isolating just the MGRS conversion code was not easy.
GDAL:
Was implemented in another programming language.
IBM (via j-coordconvert.zip):
Is complact, suits well for the UTM conversion, but the MGRS conversion is described to be errorneous. Alas.
Is there a good (compact) Java source for converting between LatLon/wgs84 and MGRS?
Finally found a sufficient good answer. Berico, thank you!
https://github.com/Berico-Technologies/Geo-Coordinate-Conversion-Java
This source code isolates the NASA Java source code and adds 1 nice utility class.
Examples:
double lat = 52.202050;
double lon = 6.102050;
System.out.println( "To MGRS is " + Coordinates.mgrsFromLatLon( lat, lon));
And the other way around:
String mgrs = "31UCU 59248 14149";
double[] latlon = Coordinates.latLonFromMgrs( mgrs);
Hi I use OpenCV Java and have some problem.
I open video file and try get property like FPS.
And others:
CV_CAP_PROP_POS_MSEC
CV_CAP_PROP_FRAME_COUNT
So first I opened video like this:
VideoCapture vC = new VideoCapture(url2);
and next i have a problem with function
vC.get(int i)
in OpenCV C++ its look like
vC.get(CV_CAP_PROP_FPS);
In Java where I find this constants?In HighGui I didnt find them. Only what I find is another libary to OpenCV where are this constants http://siggiorn.com/wp-content/uploads/libraries/opencv-java/docs/sj/opencv/Constants.CaptureProperty.html. But where I find them in OpenCV Java. Anyway how I have to use vC.get() function? Maybe some working example?
There is a bug report about this issue.
Until it is fixed, I suggest that you find these constants in the C++ source code, and define them yourself.
Edit:
I was just curious myself. You find them in the file modules/highgui/include/opencv2/highgui.hpp They are:
CAP_PROP_POS_MSEC =0,
CAP_PROP_POS_FRAMES =1,
CAP_PROP_POS_AVI_RATIO =2,
CAP_PROP_FRAME_WIDTH =3,
CAP_PROP_FRAME_HEIGHT =4,
CAP_PROP_FPS =5,
CAP_PROP_FOURCC =6,
CAP_PROP_FRAME_COUNT =7,
CAP_PROP_FORMAT =8,
CAP_PROP_MODE =9,
CAP_PROP_BRIGHTNESS =10,
CAP_PROP_CONTRAST =11,
CAP_PROP_SATURATION =12,
CAP_PROP_HUE =13,
CAP_PROP_GAIN =14,
CAP_PROP_EXPOSURE =15,
CAP_PROP_CONVERT_RGB =16,
CAP_PROP_WHITE_BALANCE_BLUE_U =17,
CAP_PROP_RECTIFICATION =18,
CAP_PROP_MONOCROME =19,
CAP_PROP_SHARPNESS =20,
CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
CAP_PROP_GAMMA =22,
CAP_PROP_TEMPERATURE =23,
CAP_PROP_TRIGGER =24,
CAP_PROP_TRIGGER_DELAY =25,
CAP_PROP_WHITE_BALANCE_RED_V =26,
CAP_PROP_ZOOM =27,
CAP_PROP_FOCUS =28,
CAP_PROP_GUID =29,
CAP_PROP_ISO_SPEED =30,
CAP_PROP_BACKLIGHT =32,
CAP_PROP_PAN =33,
CAP_PROP_TILT =34,
CAP_PROP_ROLL =35,
CAP_PROP_IRIS =36,
CAP_PROP_SETTINGS =37
use class import org.opencv.videoio.Videoio;
vc.open(FD.class.getResource("1.avi").getPath());
double totalFrameNumber = vc.get(Videoio.CAP_PROP_FRAME_COUNT);
System.out.println("\n"+totalFrameNumber);
It seems the bug is solved. Now you should be able to use it as:
VideoCapture vC = new VideoCapture(...);
nbFrames = vC.get(Videoio.CAP_PROP_FRAME_COUNT);
I need programmatically extract frames from mp4 video file, so each frame goes into a separate file. Please advise on a library that will allow to get result similar to the following VLC command (http://www.videolan.org/vlc/):
vlc v1.mp4 --video-filter=scene --vout=dummy --start-time=1 --stop-time=5 --scene-ratio=1 --scene-prefix=img- --scene-path=./images vlc://quit
Library for any of these Java / Python / Erlang / Haskell will do the job for me.
Consider using the following class by Popscan. The usage is as follows:
VideoSource vs = new VideoSource("file://c:\test.avi");
vs.initialize();
...
int frameIndex = 12345; // any frame
BufferedImage frame = vs.getFrame(frameIndex);
I would personally look for libraries that wrap ffmpeg/libavcodec (the understands-most-things library that many encoders and players use).
I've not really tried any yet so can't say anything about code quality and ease, but the five-line pyffmpeg example suggests it's an easy option - though it may well be *nix-only.
I am new to BO, I need to find universe name and the corresponding metadata information like(Table name, column names, join conditions etc...). I am unable to find proper way to start. I looked with Data Access SDK, Semantic SDk.
Can any one please provide me the sample code or procedure for starting..
I googled a lot but i am unable to find any sample examples
I looked into this link but that code will work only on R2 Server.
http://www.forumtopics.com/busobj/viewtopic.php?t=67088
Help is Highly Apprecitated.....
Assuming you're talking about IDT based universes, you'll need to code some Java. The JavaDoc for the API is available here.
In a nutshell, you do something like this:
SlContext context = SlContext.create() ;
LocalResourceService service = context.getService(LocalResourceService.class) ;
String blxFile = service.retrieve("universe.unx","output directory") ;
RelationalBusinessLayer businessLayer = (RelationalBusinessLayer)service.load(blxFile);
RootFolder rootFolder = businessLayer.getRootFolder() ;
Once you have a hook on the rootFolder, you can use the getChildren() method to drill into the folder structure and access the various subfolders/business objects available.
You may also want to check the CmsResourceService class to access universes stored on the repository.
To get the information you are after will require a 2 part solution. Part 1 use the Rebean SDK looking at WebI reports for the Universe and object names being used with in it.
Part 2 is to break out your favorite COM programming tool, since I try to avoid COM I use the Excel Macro editor, and access the BusinessObjects Designer library. Main code snippets that I currently have are:
Dim boUniv As Designer.Universe
Dim tbl As Designer.Table
For Each tbl In boUniv.Tables
Debug.Print tbl.Name
Next tbl
This prints all of the tables in a universe.
You will need to combine the 2 parts on your own for a dependency list between WebI reports and Universes.