简体   繁体   English

如何将proj4js包含到您的项目中

[英]How to include proj4js into your project

I really don't understand how to include the proj4.js into my project. 我真的不明白如何将proj4.js包含到我的项目中。 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. 但是,如果将它添加到.html文件中,我的.js文件(我将在其中使用proj4js函数)将看不到它。 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? 而且我不能将其添加到我的.js文件中,因为它是.js文件而不是.html文件。您是如何做到的? 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. 将其添加到html文件,然后在其后添加其他js文件(将使用第一个js文件的文件)。

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文件中):

<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. 然后,您的js文件将能够从库中查看所需的一切。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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