Skip to content

Des cartes statiques pour GIS

b_b a demandé de fusionner gh-0560a4b0/34/unknown/refs/pull/34/head vers master

C'est encore en test pour la compat PHP 8, mais ça semble bien fonctionner, sinon ça tourne nickel en PHP 7 :)

Éventuelle TODO avant de merger :

  • utiliser copie_locale() au lieu de curl, curl_exec, etc dans la méthode fetchTile()
  • faire une passe de phpstan sur le code introduit

Pour les gens qui veulent tester, voici un squelette de démo :

<h1>Static !</h1>

<BOUCLE_centrer(GIS){0,1}>
#SET{id_gis,#ID_GIS}
#SET{lat,#LAT}
#SET{lon,#LON}
</BOUCLE_centrer>

<h2>Un point avec un marker perso</h2>

<p>url de marker : https://www.vertlejardin.fr/plugins/vertlejardin/images/marker_defaut.png</p>

[(#REM|gis_static_map{335,170,openstreetmap_de,7,#GET{lat};#GET{lon};https://www.vertlejardin.fr/plugins/vertlejardin/images/marker_defaut.png})]

<h2>Plusieurs points +  marker perso</h2>

#SET{markers,#ARRAY}
<BOUCLE_articles2(ARTICLES){gis}
>#SET{markers,#GET{markers}|push{#LAT;#LON;http://open.mapquestapi.com/staticmap/geticon?uri=pcenter.png}}</BOUCLE_articles2>

[(#REM|gis_static_map{335,170,openstreetmap_mapnik,'',#GET{markers}|implode{'|'}})]


<h2>Tous les fonds dispos dans GIS (sauf bing & google)</h2>

#SET{layers,#LISTE{
	openstreetmap_mapnik,
	openstreetmap_de,
	openstreetmap_fr,
	openstreetmap_hot,
	opentopomap,
	stamen_toner,
	stamen_tonerlite,
	stamen_terrain,
	stamen_watercolor,
	esri_worldstreetmap,
	esri_delorme,
	esri_worldtopomap,
	esri_worldimagery,
	esri_worldterrain,
	esri_worldshadedrelief,
	esri_worldphysical,
	esri_oceanbasemap,
	esri_natgeoworldmap,
	esri_worldgraycanvas,
	cartodb_positron,
	cartodb_positron_base,
	cartodb_darkmatter,
	cartodb_darkmatter_base,
	cartodb_voyager,
	cartodb_voyager_base}}

<BOUCLE_layers(DATA){source table, #GET{layers}}>
[(#GET{id_gis}|gis_static_map{335,170,#VALEUR,7})]
</BOUCLE_layers>

En pièce jointe une image pour voir ce que ça donne.

image

Rapports de requête de fusion