简体   繁体   中英

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

Add it to your html file, and then add your other js file(the one that will use the 1st js file) right after it.

Like this:

<head>
    <script src="1stfile.js" type="text/javascript"></script>
    <script src="secondfile.js" type="text/javascript"></script>
</head> 

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM