[Maps] Use correct address for google tiles. (#2727)

This commit is contained in:
Fabien-B
2021-05-19 11:39:16 +02:00
committed by GitHub
parent 677b54c1c8
commit 7e0dbf2a2b
6 changed files with 5 additions and 97 deletions

View File

@@ -124,13 +124,10 @@ _save_build_version:
$(Q)test -d $(PAPARAZZI_HOME)/var || mkdir -p $(PAPARAZZI_HOME)/var
$(Q)./paparazzi_version > $(PAPARAZZI_HOME)/var/build_version.txt
update_google_version:
-$(MAKE) -C data/maps
init:
@[ -d $(PAPARAZZI_HOME) ] || (echo "Copying config example in your $(PAPARAZZI_HOME) directory"; mkdir -p $(PAPARAZZI_HOME); cp -a conf $(PAPARAZZI_HOME); cp -a data $(PAPARAZZI_HOME); mkdir -p $(PAPARAZZI_HOME)/var/maps; mkdir -p $(PAPARAZZI_HOME)/var/include)
conf: conf/conf.xml conf/control_panel.xml conf/maps.xml conf/tools/blacklisted
conf: conf/conf.xml conf/control_panel.xml conf/tools/blacklisted
conf/%.xml :conf/%_example.xml
[ -L $@ ] || [ -f $@ ] || cp $< $@
@@ -138,7 +135,7 @@ conf/%.xml :conf/%_example.xml
conf/tools/blacklisted: conf/tools/blacklisted_example
cp conf/tools/blacklisted_example conf/tools/blacklisted
ground_segment: _print_building update_google_version conf libpprz subdirs static
ground_segment: _print_building conf libpprz subdirs static
ground_segment.opt: ground_segment cockpit.opt tmtc.opt
static: cockpit tmtc generators sim_static joystick static_h
@@ -291,7 +288,6 @@ dist_clean :
@echo "Warning: This removes all non-repository files. This means you will loose your aircraft list, your maps, your logfiles, ... if you want this, then run: make dist_clean_irreversible"
dist_clean_irreversible: clean
rm -rf conf/maps_data conf/maps.xml
rm -rf conf/conf.xml conf/controlpanel.xml
rm -rf var
@@ -343,7 +339,7 @@ test_math:
test_sim: all
prove tests/sim
.PHONY: all print_build_version _print_building _save_build_version update_google_version init dox ground_segment ground_segment.opt \
.PHONY: all print_build_version _print_building _save_build_version init dox ground_segment ground_segment.opt \
subdirs $(SUBDIRS) conf ext libpprz libpprzlink.update libpprzlink.install cockpit cockpit.opt tmtc tmtc.opt generators\
static sim_static opencv_bebop\
clean cleanspaces ab_clean dist_clean distclean dist_clean_irreversible \

View File

@@ -1,50 +0,0 @@
# Hey Emacs, this is a -*- makefile -*-
DATADIR = $(PAPARAZZI_HOME)/conf/maps_data
Q=@
UNAME = $(shell uname -s)
ifeq ("$(UNAME)","Darwin")
MKTEMP = gmktemp
SED = gsed
else
MKTEMP = mktemp
SED = sed
endif
all: $(PAPARAZZI_HOME)/conf/maps.xml
clean:
$(Q)rm -f $(DATADIR)/maps.google.com
$(DATADIR):
mkdir $(DATADIR)
$(DATADIR)/maps.google.com: $(DATADIR) FORCE
@echo "-----------------------------------------------"
@echo "DOWNLOAD: google maps version code";
$(Q)wget -q -t 1 -T 10 --no-check-certificate -O $(@) http://maps.googleapis.com/maps/api/js || \
(rm -f $(@) && \
echo "Could not download google maps version code" && \
echo "-----------------------------------------------" && \
exit 1)
$(PAPARAZZI_HOME)/conf/maps.xml: $(DATADIR)/maps.google.com
$(eval GOOGLE_VERSION := $(shell tr -s '[[:space:]]' '\n' < $(DATADIR)/maps.google.com | grep -E "http[s]?://khm[s]?[0-9]+.google.com/kh\?v=[0-9]+\\\u" -m 1 | $(SED) -r 's#.*http[s]?://khm[s]?[0-9]+.google.com/kh\?v=##;s#.u0026.*##'))
$(eval $@_TMP := $(shell $(MKTEMP)))
$(Q)if [ "$(GOOGLE_VERSION)" -eq "$(GOOGLE_VERSION)" ] 2>/dev/null ; then \
echo "Updated google maps version to $(GOOGLE_VERSION)" ; \
echo "-----------------------------------------------" ; \
echo "<!DOCTYPE maps SYSTEM \"maps.dtd\">" > $($@_TMP) ; \
echo "" >> $($@_TMP) ; \
echo "<maps google_version=\"$(GOOGLE_VERSION)\"/>" >> $($@_TMP) ; \
echo "" >> $($@_TMP) ; \
mv $($@_TMP) $@ ; \
chmod a+r $@ ; \
else \
echo "Extracted google maps version was not a valid number: $(GOOGLE_VERSION)" ; \
fi
FORCE:
.PHONY: all clean

View File

@@ -68,7 +68,7 @@ PKGCOMMON=pprzlink,xml-light,netclient,nettls-gnutls,glibivy,lablgtk2
XINCLUDES=
XPKGCOMMON=pprzlink,xml-light,glibivy,$(LABLGTK2GNOMECANVAS),lablgtk2.glade
SRC = compat.ml fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml maps_support.ml gm.ml iGN.ml geometry_2d.ml cserial.o ubx.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml fp_proc.ml quaternion.ml
SRC = compat.ml fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml gm.ml iGN.ml geometry_2d.ml cserial.o ubx.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml fp_proc.ml quaternion.ml
SRC += gen_common.ml radio.ml settings.ml module.ml flight_plan.ml autopilot.ml airframe.ml telemetry.ml aircraft.ml
CMO = $(SRC:.ml=.cmo)
CMX = $(SRC:.ml=.cmx)

View File

@@ -218,12 +218,10 @@ let ms_key = fun key ->
let s = Bytes.to_string ms_key in
(s, s.[n-2])
let google_version = Maps_support.google_version
let url_of_tile_key = fun maps_source s ->
let (x, y, z) = xyz_of_qsrt s in
match maps_source with
Google -> sprintf "http://khm0.google.com/kh/v=%d&x=%d&s=&y=%d&z=%d" google_version x y z
Google -> sprintf "http://mt1.google.com/vt/lyrs=s&x=%d&s=&y=%d&z=%d" x y z
| OSM -> sprintf "http://tile.openstreetmap.org/%d/%d/%d.png" z x y
| MQ -> sprintf "http://otile1.mqcdn.com/tiles/1.0.0/osm/%d/%d/%d.png" z x y
| MQ_Aerial -> sprintf "http://otile1.mqcdn.com/tiles/1.0.0/sat/%d/%d/%d.png" z x y

View File

@@ -1,35 +0,0 @@
(*
* Support for obtaining google maps api information at runtime
*
* Copyright (C) 2011 Stephen Dwyer
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*)
let home = Env.paparazzi_home
let (//) = Filename.concat
let maps_xml_path = home // "conf" // "maps.xml"
let maps_xml_default_path = home // "conf" // "maps_example.xml"
let maps_xml = ExtXml.parse_file maps_xml_path
let maps_xml_default = ExtXml.parse_file (maps_xml_default_path)
let gv = try Some (ExtXml.int_attrib maps_xml "google_version") with _ -> None
let gv_default = try ExtXml.int_attrib maps_xml_default "google_version" with _ -> 0
let google_version = match gv with Some v -> v | None -> gv_default

View File

@@ -1 +0,0 @@
val google_version : int