Search code examples
javascripthtmlproj4js

How to include proj4js into your project


I really don't understand how to include the proj4.js into my project. Following the documentation I should add

<script src="lib/proj4js-combined.js"></script>

in the code. But if I add it into the .html file my .js file (in which I will use the proj4js functions) will not see it. And I can not add it into my .js file as it is a .js file and not an .html file.. How did you do it? Thanks


Solution

  • If you just load them in order (in your html file):

    <html>
        <head>
            <script src="lib/proj4js-combined.js"></script>
            <script src="myfolder/js-file-with-proj4js-functions.js"></script>
        </head> 
    <body>
        ...
    

    Then your js file will be able to see everything it needs from the library.