Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>Remarquables</title>
    <link rel="icon" type="image/x-icon" href="style/favicon.png"> <!--icone de la page web, s'affiche à droite de l'onglet. Disponible ici : https://github.com/JapaLenos/JS-API/blob/main/Jardins-Parisiens/style/favicon.png-->
      
    <link 
        rel="stylesheet" 
        href="style/style.css" 
    /> <!--lien vers ma feuille de style personnalisée. Attention à adapter le chemin à votre projet-->
    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.27/esri/themes/light/main.css" 
    /><!--lien vers la feuille de style de l'API.-->
      
    <script src="https://js.arcgis.com/4.27/"></script><!--lien vers l'API JavaScript d'ArcGIS, nous permettant de faire appel à ses services-->
    <script src="app/step5-labels-main.js"></script><!--lien vers mon code JavaScript. Attention à adapter le chemin à votre projet-->
  </head>

  <body>

    <div id="full">
      <div id="viewDiv"></div><!--balise div qui contiendra la vue de la carte-->
      <div class="mentions"><!--optionnel : habillage du site = ajout des crédits-->
        <h4>
          RÉALISÉ AVEC 
          <a
            href="https://developers.arcgis.com/javascript/latest/"
            target="_blank"
            >L'API JAVASCRIPT D'ARCGIS</a
          >
          <br/>GITHUB :
          <a
            href="https://github.com/JapaLenos/JS-API/tree/main/Jardins-Parisiens"
            target="_blank"
            >@JAPALENOS</a
          ><br/>
          DONNÉES ISSUES DU
          <a
            href="https://opendata.paris.fr/explore/dataset/arbresremarquablesparis/export/"
            target="_blank"
            >PORTAIL OPEN DATA PARIS | DATA
            </a>  
        </h4>
      </div>
    </div>
      
  </body>
</html>

              
            
!

CSS

              
                body{
    user-select: none;
    margin: 0  ;
}
,
  #viewDiv {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
    position : relative
  }
  #viewDiv {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
    position : absolute
  }

  h1 {
    padding-top : 1.5%;
    font-weight: bolder;
    font-size: 450%;
    font-family: "Playfair Display", "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
    color: #7B656F;
    text-shadow: 1px 1px 2px white;
    opacity : 90%;
    position: absolute;
    text-align: center;
    height : 10%;
    margin: auto;
    z-index: 1;
  }

  h2 {
    font-family: "Playfair Display", "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
  }

  h2.esri-widget__heading {
    color: #7B656F;
  }

  h3 {
    padding-top : 1%;
    font-weight: normal;
    font-size: 70%;
    font-family: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
    color: rgb(104, 104, 104);
    position: absolute;
    z-index: 9;
    text-align: center;
    width : 100%;
    height : 10%;
    text-align: center;
    margin: auto;
    
  }
  h4 {
    padding-top : 1%;
    font-weight: bold;
    font-size: 70%;
    font-family: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
    color: #473B40;
    position: absolute;
    z-index: 10;
    text-align: left;
    margin-left: 5%;
    bottom : 1%;
    
  }

  a {
    color: #7B656F;
    font-weight: bold;
    text-decoration: none;
    text-shadow: -1px 0 #FFF, 0 1px #FFF, 1px 0 #FFF, 0 -1px #FFF
  }

div.esri-widget--button {
    background-color: #FFF;
    color: #7B656F;
    z-index: 10
}

    .label-wrapper {
      display: flex;
      cursor: pointer;
    }
              
            
!

JS

              
                require([
        "esri/Map",
        "esri/Basemap",
        "esri/views/SceneView",
        "esri/layers/GeoJSONLayer",
        "esri/popup/content/TextContent",
        "esri/popup/content/MediaContent",
        "esri/popup/content/ImageMediaInfo",
        "esri/popup/content/support/ImageMediaInfoValue"
          
      ], 
        
        (Map, Basemap, SceneView ,GeoJSONLayer,TextContent,MediaContent,ImageMediaInfo,ImageMediaInfoValue) => {
          
          
        const map = new Map({
          basemap: new Basemap({
            portalItem: {
              id: "0560e29930dc4d5ebeb58c635c0909c9" // References the 3D Topographic Basemap
            }
          })
        });
        
          const view = new SceneView({
          container: "viewDiv",
          map: map,
            camera: {
              position: {
                longitude: 2.340861136194503,
                latitude: 48.88276594605576,
                z: 178.8139155479148,
              },
              heading: 29.620133897254565,
              tilt: 65.59724234196116,
            },
          popup: { //épinglera automatiquement les fenêtres contextuelles en bas à droite
            dockEnabled: true,
            dockOptions: {
              position: "bottom-right",
              breakpoint: false,
              buttonEnabled: false
            },
          }
        });
          
        view.when(() => {
            
        ///////Modification de la symbologie
            
        // convenience function to retrieve the WebStyleSymbols based on their name
        function getTreeSymbol(name) {
          return {
            type: "web-style", // autocasts as new WebStyleSymbol()
            name: name,
            styleName: "EsriLowPolyVegetationStyle"
          };
        }
            
        const treeRenderer = {
          type: "unique-value", // autocasts as new UniqueValueRenderer()
          field: "arbres_libellefrancais",
          defaultSymbol: getTreeSymbol("Chilopsis"),
          uniqueValueInfos: [
            {
              value: "Aulne",
              symbol: getTreeSymbol("Frangula")
            },
            {
              value: "Bouleau",
              symbol: getTreeSymbol("Betula")
            },
            {
              value: "Cèdre",
              symbol: getTreeSymbol("Calocedrus")
            },
            {
              value: "Chêne",
              symbol: getTreeSymbol("Quercus Rubra")
            },
            {
              value: "Cyprès Chauve",
              symbol: getTreeSymbol("Taxodium")
            },
            {
              value: "Erable",
              symbol: getTreeSymbol("Acer")
            },
            {
              value: "Hêtre",
              symbol: getTreeSymbol("Fagus")
            },
            {
              value: "Magnolia",
              symbol: getTreeSymbol("Magnolia")
            },
            {
              value: "Marronnier",
              symbol: getTreeSymbol("Castanea")
            },
            {
              value: "Noisetier de Byzance",
              symbol: getTreeSymbol("Hamamelis")
            },
            {
              value: "Noyer",
              symbol: getTreeSymbol("Juglans")
            },
            {
              value: "Oranger des Osages",
              symbol: getTreeSymbol("Citrus")
            },
            {
              value: "Orme",
              symbol: getTreeSymbol("Ulmus")
            },
            {
              value: "Orme de Sibérie",
              symbol: getTreeSymbol("Ulmus")
            },
            {
              value: "Platane",
              symbol: getTreeSymbol("Platanus")
            },
            {
              value: "Pin",
              symbol: getTreeSymbol("Pinus")
            },
            {
              value: "Saule",
              symbol: getTreeSymbol("Salix")
            },
            {
              value: "Sequoia",
              symbol: getTreeSymbol("Sequoiadendron")
            },
            {
              value: "Tilleul",
              symbol: getTreeSymbol("Tilia")
            },
          ],
          visualVariables: [
            {
              type: "size",
              field: "arbres_hauteurenm",
              axis: "height",
              valueUnit : "meters"
            }
          ]
        };
            
            /////Création d'une couche à partir du JSON
            const arbresRemarquables = new GeoJSONLayer({
                url: "https://raw.githubusercontent.com/JapaLenos/JS-API/main/Jardins-Parisiens/app/arbresremarquablesparis.geojson",
                copyright: "Arbres remarquables - Open portail Paris Data",
                renderer: treeRenderer,
                elevationInfo: {
                    mode: "on-the-ground"
                }
            });
            //Ajout d'une couche à la carte
            map.add(arbresRemarquables);
            
            
        /////Création des popups
            
        const textElement1 = new TextContent();
        textElement1.text = "Cet arbre remarquable est un <b>{com_nom_usuel}</b> (nom vernaculaire) ou <b>{com_nom_latin}</b> (nom latin). Il appartient à l'espèce <b>{arbres_espece}</b> du genre <b>{arbres_genre}</b> et mesure <b>{arbres_hauteurenm} mètres </b> pour une circonférence de <b>{arbres_circonferenceencm} centimètres.</b> </br> Date de plantation : {com_annee_plantation}"  
        
        const textElement2 = new TextContent();
        textElement2.text = "{com_descriptif}" 
            
            
        // Create the ImageMediaInfoValue
        let imageMediaInfoValue = new ImageMediaInfoValue({
                sourceURL: "{com_url_photo1}"
            });

        // Create the ImageMediaInfo
        let imageElement = new ImageMediaInfo({
            caption: "{com_resume}",
            value: imageMediaInfoValue
        });

        // Create the MediaContent
        let mediaElement = new MediaContent({
            mediaInfos: [ imageElement ]
        });

            
        arbresRemarquables.popupTemplate = {
        title: "{com_nom_usuel} / {com_nom_latin}",    
        content : [textElement1,mediaElement, textElement2]
        };   
        
            
        //////Labels
            
        let labelClass = {  // autocasts as new LabelClass()
          symbol: {
            type: "label-3d",  // autocasts as new TextSymbol()
            symbolLayers: [{
                type: "text",  // autocasts as new TextSymbol3DLayer()
                material: { color: "#7B656F"},
                halo : {color : "#FFF", size : "1px"},
                size: 12,  // Defined in points
                font: {  // autocast as new Font()
                    family: "Playfair Display",
                    style : "italic",
                    weight : "bold",
                    size: 12,
                }
            }],
            verticalOffset: {
                screenLength: "25px",
            },
            callout: {
                type: "line", // autocasts as new LineCallout3D()
                size: 0.2,
                color: "#7B656F",
/*                border: {
                    color: "#FDF6F0"
                }*/
            }
          },
          //labelPlacement: "above-right",
          labelExpressionInfo: {
            expression: "$feature.com_nom_usuel"
          },
        };
        // Add labels to the feature layer
        arbresRemarquables.labelsVisible = true;
        arbresRemarquables.labelingInfo = [labelClass];
            
        
            
        //////Rendre les autres arbres invisibles
        let treeLayer = map.basemap.referenceLayers.find(function(layer){
            return layer.id === "1872932aeb4-layer-48";
        });
        treeLayer.visible = false ;
            
        
            
        });
});
              
            
!
999px

Console