• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

426
Vistas
no se puede obtener la propiedad 'getRegularPolygon' de indefinido o nulo

Utilizo invocar script en C# para llamar a SetCoords y parece que todo funciona bien hasta que se encuentra con la línea "getRegularPolygon". No puedo encontrar ninguna documentación para el método, pero obtuve la segunda mitad de la función SetCoords de esto: https://docs.microsoft.com/en-us/bingmaps/v8-web-control/map-control-concepts /spatial-math-module-examples/geolocation-accuracy-circle-example Otros lugares en los que he buscado respuestas dicen algo sobre "getelementbyid", pero eso no parece aplicarse aquí.

 <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" /> <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key={mykey}' async defer></script> <script type='text/javascript' async defer> var map, infobox, pushpin, radius; var centerlattitude = 0.0; var centerlongitude = 0.0; function GetMap() { var center = new Microsoft.Maps.Location(centerlattitude, centerlongitude); map = new Microsoft.Maps.Map('#myMap', { center: center, zoom: 20 }); pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(centerlattitude, centerlongitude + 0.0005), { draggable: true }); map.entities.push(pushpin); Microsoft.Maps.Events.addHandler(pushpin, 'changed', getNewCenter); } function SetCoords(lat, long, rad) { centerlattitude = lat; centerlongitude = long; radius = rad; GetMap(); var path = Microsoft.Maps.SpatialMath.getRegularPolygon(center, radius*1000, 8, Microsoft.Maps.SpatialMath.Meters); var poly = new Microsoft.Maps.Polygon(path); map.entities.push(poly); } </body> </html>
over 2 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Debe cargar la biblioteca de matemáticas espaciales. Bing Maps está modularizado para ayudar a reducir el tamaño total de las aplicaciones para que los desarrolladores solo carguen las partes que necesitan para garantizar una carga inicial rápida de la aplicación. Tenga en cuenta que la carga de módulos es asíncrona, por lo que debe ejecutar su código que accede al módulo, una vez que haya terminado de cargarse. Aquí hay un ejemplo:

 //Load the spatial math module Microsoft.Maps.loadModule("Microsoft.Maps.SpatialMath", function () { var path = Microsoft.Maps.SpatialMath.getRegularPolygon(center, radius*1000, 8, Microsoft.Maps.SpatialMath.Meters); var poly = new Microsoft.Maps.Polygon(path); map.entities.push(poly); });
over 2 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda