Tag: google maps api 3

运行webpack部署configuration时如何解决'window is not defined'?

我试图部署一个反应+服务器应用程序到Heroku。 总体目标是使用Heroku dyno作为通用服务器来提供静态资源,并充当我的React应用程序的API端点。 我正在编写一个部署configuration来缩小和遇到一个错误。 它缩小了,但在node dist/bundle.js它给出了以下错误。 ReferenceError: window is not defined 要使用googlemaps api,我有一个Map组件,它将全局窗口对象上的一个函数设置为initMap() ,在Map组件中定义。 并在一个loadJS()引用window.document两次。 正在开发中,它工作正常。 我使用这个post来帮助使Google地图与React协同工作 我怀疑窗口对象是未定义的,因为没有浏览器提供窗口对象。 你能证实我的怀疑吗? 需要什么来弥补这个问题? 脚本在我的package.json文件中 "scripts": { "start": "npm build && node dist/bundle.js", "dev-start": "babel-node server/buildScripts/server.js", "build":"webpack –config ./webpack.deployment.config.js", "test": "echo \"Error: no test specified\" && exit 1" }, webpack.deployment.config.js const path = require('path'); const webpack = require('webpack'); module.exports […]

在ejs中的地图api“谷歌未定义”错误

为什么在使用Maps API时出现“google未定义”的错误? 我试图删除脚本标记中的asynchronous像在其他一些职位,但也没有工作。 我仍然在学习EJS的语法,所以也许是这样的。 它指向第二个for循环开始制作标记的那一行。 <body> <% console.log(values)%> <% for (i=0; i<values.length; i++) { %> <% var o = JSON.parse(values[i])%> <% var lat = o.latitude%> <% var long = o.longitude%> <% var desc = o.description%> <% var name = o.name%> <li><%=o.latitude%></li> <% } %> <div id="map"></div> <script> function initMap() { var map = new google.maps.Map(document.getElementById('map'), […]

为什么Google地图标记和InfoWindow不居中?

我用这个代码制作一张地图 var map; var myOptions = { center: new google.maps.LatLng(-31.403759,-64.174232), zoom: 12, panControl: true, zoomControl: true, mapTypeControl: true, scaleControl: true, streetViewControl: true, overviewMapControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; function iniciar() { map = new google.maps.Map(document.getElementById("map"),myOptions); } function marcar(lat, lng) { var contentString = '<div id="content">'+ '<div id="siteNotice">'+ '</div>'+ '<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+ '<div id="bodyContent">'+ '<p><b>Uluru</b>, also referred […]

如何设置node-googlemaps? 缺乏关于安装Node包的一些隐含的知识

我正在尝试使用https://github.com/moshen/node-googlemaps上的node-googlemaps npm包。 文档假定用户知道一般的NodeJS包安装过程。 所以首先,我用npm来安装它: npm install googlemaps 现在在我的server.js根文件中,我知道我需要导入实际的文件。 类似于: var gmaps = require('./node_modules/googlemaps/libs/index'); 但我这是不正确的。 也许我错过了安装NodeJS包的一些约定。 在这种情况下,我很乐意学习! README.md提到设置configuration如下所示: var publicConfig = { key: '<YOUR-KEY>', stagger_time: 1000, // for elevationPath encode_polylines: false, secure: true, // use https proxy: 'http://127.0.0.1:9999' // optional, set a proxy for HTTP requests }; var gmAPI = new GoogleMapsAPI(publicConfig); 但是我得到一个错误“GoogleMapsAPI”没有定义。 有道理,我没有导入js文件。 那我该怎么做? 什么是安装/包括NodeJS包到您的项目的标准过程?

什么是通过半径API或Node.js模块为世界拉链的很好的search?

所以我实际上遇到了麻烦。 最初我find了一个叫做邮政编码的npm模块。 正是我想要的function方面有一点额外,但它只适用于美国。 在失望后,我search了npm,找不到包括美国,欧洲或世界其他地方在内的任何东西。 那么我想,谷歌应该有一个API。 那么他们实际上不是。我能够做的最好的是得到经纬度和长坐标的邮政编码。 我一直在寻找大约一个星期,到目前为止,我担心我将不得不创build一个数据库来进行坐标search。 我只是希望有另一个解决办法,而不是必须这样做。 但是我可能一直在寻找错误的东西。 我的大部分search都包括邮政编码查询或半径的地理邮政编码。

Android本机应用程序与跨平台应用程序

我是Andorid新手。 我正在开发一个使用Google Map API的应用程序,并调用Web服务并通过套接字IO传输数据。 我想知道它可以实施为本机应用程序或跨平台的应用程序。 我搜查了很多。 但我不能得到正确的。 告诉我哪一个很简单,为什么不是另一个。 提前致谢

错误:GoogleMapsAPI没有为node-googlemaps定义

我正在使用node-googlemaps从Node js查询Google Maps API 。 我已经创build了我的服务器API密钥作为开发人员。 根据这个文档,我必须使用我的API密钥和某些其他参数来创build一个publicConfigvariables。 我的publicConfigvariables如下所示: var gm = require('googlemaps'); var publicConfig = { key: 'myKey', stagger_time:1000, // for elevationPath encode_polylines:false, secure:true // use https }; var gmAPI = new GoogleMapsAPI(publicConfig); 当我运行代码时,出现以下错误 ReferenceError: GoogleMapsAPI is not defined 有人可以帮我解决这个问题吗?

平均值和地理空间查询 – find相交的另一个LineStrings命名

我试图build立一个应用程序使用平均水平,但现在我卡住时,试图find linestrings intersecting on another one given its name 。 例如,给出以下图像, poly1和poly2应该有交点,而poly3不要。 假设poly1具有以下坐标和以下JSON : { "_id" : ObjectId("57ab2107505ab11b1bd8422e"), "name" : "poly1", "updated_at" : ISODate("2016-08-10T12:41:43.789+0000"), "created_at" : ISODate("2016-08-10T12:41:43.780+0000"), "geo" : { "coordinates" : [ [14.59, 24.847], [28.477, 15.961] ], "type" : "LineString" }, "__v" : NumberInt(0) } 当我在MongoChef上运行查询时,我发现poly1和poly2都没有find像我想要的poly3 : { geo :{ $geoIntersects:{ $geometry :{ type: […]

利用浏览器caching外部文件

我使用谷歌pagespeed洞察来testing我的nodejs网站的性能。 对于一些外部文件,它说是利用浏览器caching,但我不知道如何做到这一点? 利用浏览器caching 在静态资源的HTTP头文件中设置失效date或最大使用期限指示浏览器从本地磁盘加载之前下载的资源,而不是通过networking。 利用浏览器caching来获取以下caching资源: http://maps.googleapis.com/ … kwPPoBErK _– SlHZI28k6jjYLyU&sensor = false(30分钟) http://www.google-analytics.com/analytics.js(2小时) 任何人都可以帮助我。