编辑:有效的解决方案。 (可以使用DevBab所做的更改)。
其他:添加了用于设置多边形样式的选项。 (var polyStyle)
var url = 'http://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json' +
'?app_id='+ app_id +
'&app_code=' + app_code +
'&prox=' + lat +','+ lng +',1000' +
'&mode=retrieveAddresses&maxresults=1' +
'&level=county'+
'&additionaldata=IncludeShapeLevel,county';
$.getJSON(url,function (data) {
var location = data.Response.View[0].Result[0].Location;
var wktShape = location.Shape.Value;
var polyStyle = {
strokeColor: 'red',
fillColor: 'rgba(255, 255, 255, 0.3',
lineWidth: 2
};
var geoPoint = H.util.wkt.toGeometry(wktShape);
map.addObject(new H.map.Polygon(geoPoint,{style:polyStyle}));
});
答案 0 :(得分:1)
您要创建的是多边形,而不是标记,因此请进行以下修改:
const bcrypt = require("bcrypt")
const Promise = require("bluebird")
module.exports = {
attributes: {
firstName: {
type: "string",
required: true
},
lastName: {
type: "string",
required: true
},
username: {
type: "string",
required: true,
unique: true
},
email: {
type: "email",
required: true,
unique: true
},
password:{
type: "string",
minLength: 6,
required: true,
columnName: "encryptedPassword"
},
customToJSON: function(){
const obj = this.toObject()
delete obj.password
}
}
};
通过:
map.addObject(new H.map.Marker(geoPoint));