Converting coordinates from SVY21 to WGS84 - shapefile

I am trying to transform the SVY21 coordinates I have to the WGS84 coordinate system.
I tried using the GDAL software and pasted the following into command after installing:
ogr2ogr -f GeoJSON –t_srs WGS84 <jsonFileName>.json <shapefile>.shp
It results in the failure:
Unable to open datasource 'WGS84' with the following drivers
And the drivers are listed.
Also I tried to use the python utm package to convert the N48 utm coordinate to WGS48, but I did not manage to convert the SVY21 coordinates to the N48 utm reference point.
I found the proposed solution in this old post confusing in terms of terminology and I would prefer using some existing solution.
Is there a "easy" solution that makes use of my previous approaches or is quickly applicable to my problem? I would also be happy if someone could provide me with a more precise explanation of the approach featured in the older post.
Thanks in advance.
Edit: I tried writing a python script that implements the vicenty direct calculation from the "old post" mentioned before. It would also help, if someone could confirm that substracting the False Coordinates of Projection Origin (28001.642mE,38744.572mN) from the raw svy21 (e,n) and using the Projection Origin (Unmarked point) (103° 50' 00", 1° 22' 00") is correct.

I was compiling gdal by hand and I could use the following command to do what you wanted:
You have to copy the *.shp (and *.shx) files beside the ogr2ogr-command (Source: https://gis.stackexchange.com/questions/56652/how-to-move-and-open-shapefiles-with-ogr2ogr)
gdal does not immediately know "EPSG:3414" - the EPSG name for SCY21, so give it a hint, this is in the [INSTALL LOCATION]/data (i dont know where it is on an installed version, especially not on windows. Search for a file called "gcs.csv", and point GDAL_LOCATION to the containing folder.
define t_srs and s_srs eccordingly
Define the output format ("GEOJson")
Summa summarum:
GDAL_DATA="../data" ./ogr2ogr -f "GEOJson" "LaneMarking_wgs84.json" "LaneMarking.shp" -t_srs WGS84 -s_srs "EPSG:3414"
Have fun :)

Related

complex eigenvalues in opencv [duplicate]

I'd have thought that google could answer this question, but I've not had much luck.
Does anyone know of any open source C++ implementations of any face detection algorithms other than the Viola-Jones (boosted cascades of Haar-like features) method?
Also, does there exist an open source C++ implementation of Fisherfaces anywhere?
Thanks.
This post gets some attention, so I'd like to update it. I've contributed the face recognition library I wrote to OpenCV, which includes Eigenfaces, Fisherfaces and Local Binary Patterns Histograms at time of writing this. So OpenCV 2.4.2 now comes with everything to get started, see the very detailed documentation:
http://docs.opencv.org/trunk/modules/contrib/doc/facerec/
Now the original answer.
I am the author of the article linked in Kevin's post. Please note that you need to find the eigenvalues of the non-symmetric matrix S_{W}^{-1} S_{B} for the Fisherfaces, I didn't explicitly mention it in my blog. OpenCV only has a solver for symmetric matrices in its current version; since eigenvalues and singular values aren't equivalent for non-symmetric matrices you can't use a SVD either. For my project I have adapted the JAMA solver to C++ for solving the eigenvalue problem for non-symmetric matrices, so there's no need to use an external library for it. The CMakeLists.txt is configured, so Eigen can be used as well, so you have the choice.
Now I've finally found some minutes to implement the Fisherfaces method with the OpenCV2 C++ API and pushed the code into my github account at:
https://github.com/bytefish/opencv/blob/master/lda
The main.cpp shows you how to use the Fisherfaces class and how to use the Linear Discriminant Analysis with the same example as on: http://www.bytefish.de/wiki/pca_lda_with_gnu_octave. It comes as a CMake project, so compiling is as easy as typing:
philipp#mango:~/some/dir$ mkdir build; cd build
philipp#mango:~/some/dir/build$ cmake ..
philipp#mango:~/some/dir/build$ make
philipp#mango:~/some/dir/build$ ./lda
I don't know if it's the preferred Stackoverflow way to post code in the answer, but I think it's a bit too long to post.
Please note two things. (1) I read the images from a CSV file (just like this one), you don't have to care about the order of the labels. (2) I store the eigenvectors by column, while the PCA in OpenCV stores them by row. It's just a matter of personal taste to do so, but I've never seen that for any other solver and so I decided to store them by column.

C++ face detection/recognition implementations

I'd have thought that google could answer this question, but I've not had much luck.
Does anyone know of any open source C++ implementations of any face detection algorithms other than the Viola-Jones (boosted cascades of Haar-like features) method?
Also, does there exist an open source C++ implementation of Fisherfaces anywhere?
Thanks.
This post gets some attention, so I'd like to update it. I've contributed the face recognition library I wrote to OpenCV, which includes Eigenfaces, Fisherfaces and Local Binary Patterns Histograms at time of writing this. So OpenCV 2.4.2 now comes with everything to get started, see the very detailed documentation:
http://docs.opencv.org/trunk/modules/contrib/doc/facerec/
Now the original answer.
I am the author of the article linked in Kevin's post. Please note that you need to find the eigenvalues of the non-symmetric matrix S_{W}^{-1} S_{B} for the Fisherfaces, I didn't explicitly mention it in my blog. OpenCV only has a solver for symmetric matrices in its current version; since eigenvalues and singular values aren't equivalent for non-symmetric matrices you can't use a SVD either. For my project I have adapted the JAMA solver to C++ for solving the eigenvalue problem for non-symmetric matrices, so there's no need to use an external library for it. The CMakeLists.txt is configured, so Eigen can be used as well, so you have the choice.
Now I've finally found some minutes to implement the Fisherfaces method with the OpenCV2 C++ API and pushed the code into my github account at:
https://github.com/bytefish/opencv/blob/master/lda
The main.cpp shows you how to use the Fisherfaces class and how to use the Linear Discriminant Analysis with the same example as on: http://www.bytefish.de/wiki/pca_lda_with_gnu_octave. It comes as a CMake project, so compiling is as easy as typing:
philipp#mango:~/some/dir$ mkdir build; cd build
philipp#mango:~/some/dir/build$ cmake ..
philipp#mango:~/some/dir/build$ make
philipp#mango:~/some/dir/build$ ./lda
I don't know if it's the preferred Stackoverflow way to post code in the answer, but I think it's a bit too long to post.
Please note two things. (1) I read the images from a CSV file (just like this one), you don't have to care about the order of the labels. (2) I store the eigenvectors by column, while the PCA in OpenCV stores them by row. It's just a matter of personal taste to do so, but I've never seen that for any other solver and so I decided to store them by column.

Do I need specific configuration for Spatialite with GeoDjango?

According to https://docs.djangoproject.com/en/1.3/ref/contrib/gis/db-api/, Spatialite supports GeoQuerySet.distance(). However, having imported an area list (MultiPolygon as mpoly attribute), I'm trying to do the following:
Area.objects.all().distance(center)
And instead of something usable, I only get an error message: "ValueError: SQLite does not support linear distance calculations on geodetic coordinate systems."
What's wrong here, do I need some special configuration on Spatialite or is the documentation plain wrong?
You don't need to do anything regarding spatialite, but rather change the coordinate system (srid) you're using. Spatialite does distance calculations only on geographic coordinate systems, not geodetic. Check the SRID do you have in your model definition. Alternatively you can also switch to the postgis backend.

Graph-Drawing / TSP-Route-Drawing in C++ with "known" coordinates: How? Which Library/Tool?

i'm developing some kind of heuristics for a variation of the vehicle-routing-problem in C++.
After generating a solution, i want to plot this solution. The solution is a composite of various tours, all starting and ending at a common depot.
Therefore i have a vertex-set with all the coordinates and edges defined by two vertex-id's each. Furthermore i have all the distances between vertex-pairs of course.
It would be helpful to plot this in an extra-window opening in my program, but writing a plot to a graphics-file should be okay too.
What is an easy way to plot this? How would you tackle this?
First i tried to look for common graph-visualization packages (graphviz, tulip, networkx (python)), but i realized that all of them are specialized at graph-layouting (when there are no coordinates). Correct me when i'm wrong.
I don't know if it is possible to tell these packages that i already have the coordinates, helping the layouting-algorithms.
Next thing i tried is the CGAL library with geomview output -> no luck until now -> ubuntu crashes geomview.
One more question: Is it a better idea to use some non-layouting 2d-plot-libraries risking a plot, which isn't really good to view at (is there more to do than scaling?) or to use some layout-algorithm-based-libraries (e.g. graphviz, tulip, networkx), feed them with the distances between the vertices and hope the layouting-algorithms are keeping the distances while plotting in a good-to-view-at way?
If non-layouting-plotting is the way to do it: which library do you recommend?
If layout-based-plotting is the way to do it: how can i make use of the distances/coordinates in these libraries? And which library do you recommend?
Thanks for all your input!
Sascha
EDIT: I completed a prototype implementation using the PLplot library (http://plplot.sourceforge.net/). The results are nice and should be enough for the moment. I discovered and chosed this library because a related project (VRPH Software Package / Groer) used this plot and the source code was distributed. So the implementation was done in a short amount of time. The API is in my opinion bit awkward and low-level. Maybe there are some more modern (maybe not a c-based library) libraries out there? MathGL? Dislin? Maybe i will try them too.
The nice thing about drawing multiple tours in a vehicle routing problem is that "not so bad" algorithms tend to discover nice non-overlapping and divergent tours which is really good for the eye ;-)
It is not quite clear what you are trying to archive, but if I understand your question correctly, then you could do it using OpenGL. Having vertex coordinates, it should be fairly easy.
You can use Gnuplot with a input text file that contains your solution.
It is convenient to draw the points (vertex) then lines (agents paths) than link them.
To make the plot script easy, you can have a separate file for each vehicle, if the number
of vehicles is known.
check out:
http://www.cleveralgorithms.com/nature-inspired/advanced/visualizing_algorithms.html

How to convert UTM Coordinate in C to Latitude/Longitude using WGS84 Datum?

Does anyone know where I can find open source code (in c++) that converts a UTM point to Geo (WGS 84)?
Thanks,
Liran
Take a look at GDAL.
Specifically the code used here.
There is also a Warp API tutorial here which outlines the basic use of the Warp API.
Alternatively, you can use the more lightweight PROJ.4 library (GDAL uses this internally).
While not C++ per se, I have written it in Objective-C and could more or less be copied and pasted into C or C++ with a few minor alterations.
UTMConverter example for iOS
The part you want is a file called UTMConverter.m. It has methods for converting from lat/long to UTM and vice-versa.