#
GPS Triangulation
You have already built a map and you want to triangulate it with google maps.You can now easily do so using this feature.
#
Downloading Your Map
You can login to the Developer Portal and download the Sparse.ply file from the map you want to triangulate.
Click on
map-name-sparse.ply
to download the map
#
Triangulating
Open blender.
Import the .ply point cloud file to blender.
Rotate it 90 degrees in x in blender.
Find at least 3 points that you can recognize from google maps.
Add the points to
map_ecef_from_3_wgs84_points.py
. (Please see the /blender-googlemaps-example-images) to do the conversion correctly.
def main() -> None:
# 3 manually picked points in the map x, y, z
map_position_a = np.array([0, 0, 0])
map_position_b = np.array([0, 0, 0])
map_position_c = np.array([0, 0, 0 ])
- Find the same points in google maps. Add them to the
map_ecef_from_3_wgs84_points.py
script.
You can get a good altitude estimate for example in Google Earth
# latitude, longitude, and altitude values for the 3 points (From Google maps)
wgs84_a = np.array([0.0, 0.0, 0.0])
wgs84_b = np.array([0.0, 0.0, 0.0])
wgs84_c = np.array([0.0, 0.0, 0.0])
Run the script. You need to add your token and mapid. It will also ask to pip install bunch of libraries. Install them.
After the script runs successfully it will print out the result and update the map metadata in developer portal. To verify this. Check the metadata.json for the map from the portal.
#
Testing the map
Download test images that you know have been captured in within the same area. Use the support portal to download the job.
Run
localize-map-images_lat_lon.py
. You need to add the folder where the images are and your token and map id. The script will create alocalization_results.json
and will write each loc there. You can also stop the script if you don't want to localize all images in the images folder.Run the
show-locs-on-folium.py
. You need to also add to the script thelocalization_results.json
path. The script will run and open up the browser it will also create alocalization_map.html
file. You will see a map with the successful localization results. If you click a point on the map it will open up showing the lat, lon and image path.Copy paste the image path open terminal and type $open and paste the image path. example:
$open /path/to/image
That way you can check if the images match to the map.
#
To Run
Create a virtual env. Type these commands to terminal.
$ python -m venv env
$ source env/bin/activate
if you don't have folium install with this command
$ pip install folium
then you run the python script
To deactivate the virtual env use
$ deactivate
#
Video Tutorial
Here is the video tutorial for all the steps.