Using Google Earth or Cesium to display moving shapes on a map

I'm feeling quite puzzled at the moment and could really use some advice.

My goal right now is to achieve a Satellite view of a random building, complete with the typical RoadMap/3D effect found on Google Maps:

I also want to incorporate three.js to render polygons on top of that map.

I tried following examples from this git repo:

examplegitrepository.com/google-maps-api-threejs-layer

However, I am having trouble adding particles to the map...I can't seem to include geometries like polygons, splines, and other shapes.

At this point, I'm not sure what to do next...maybe Cesium is the solution?

Although, Cesium doesn't offer the same "3D" feature for buildings...

Any guidance or assistance would be greatly appreciated!

Thank you!

Answer №1

Google Maps V3 allows you to use polygons, lines, and markers.

You can check out the following links for more information on Google Developer resources:

I am referring specifically to the native polygon, polyline, marker, or native drawing tools of google maps v3. For examples, visit https://developers.google.com/maps/documentation/javascript/examples/drawing-tools and https://developers.google.com/maps/documentation/javascript/examples/polygon-simple

Another useful resource is provided by Dyer at .

function drawExcrudedShape(map, coordinates, height, strokeColor, strokeOpacity, strokeWeight, fillColor, fillOpacity) {

var pairs = [],
    polygons = [];

// build line pairs for each wall
for (var i=0; i<coordinates.length; i++) {

    var point = coordinates[i],
        otherIndex = (i == coordinates.length-1) ? 0 : i+1,
        otherPoint = coordinates[otherIndex];

    pairs.push([point, otherPoint]);
}

// draw excrusions
for (var i=0; i<pairs.length; i++) {

    var first = pairs[i][0],
        second = pairs[i][1],
        wallCoordinates =  [
            new google.maps.LatLng(first[0],first[1]),
            new google.maps.LatLng(first[0]+height,first[1]),
            new google.maps.LatLng(second[0]+height,second[1]),
            new google.maps.LatLng(second[0],second[1])                                 
        ],
        polygon = new google.maps.Polygon({
            paths: wallCoordinates,
            strokeColor: strokeColor,
            strokeOpacity: strokeOpacity, 
            strokeWeight: strokeWeight,
            fillColor: fillColor,
            fillOpacity: fillOpacity,
            zIndex: zIndexBase+i
        });

    polygon.setMap(map);

    polygons.push(polygon);
}       

return polygons;

}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using jQuery or JavaScript to clear multiple selections in a multiselect dropdown when a button is clicked

Is there a way to clear the dropdown selections once my function saves data to local storage? You can refer to this fiddle for more details: http://jsfiddle.net/3u7Xj/139/ I already have code in place to handle other form elements: var $form = $("#formI ...

The preventDefault() function is not functioning properly on the <a> tag

As a JavaScript beginner, I decided to create an accordion menu using JavaScript. Although I was successful in implementing it, I encountered a bug in my program. In this scenario, uppercase letters represent first-level menus while lowercase letters repr ...

Validation of forms in AngularJS/HTML5 that are nested within one another

Just starting out with AngularJS and experiencing issues with HTML5 nested form validation. I currently have 2 forms; mainFrm (parent form) and stateFrm (a child form). I am struggling to validate each form within its own scope. <form id="mainFrm" ng- ...

Retrieving the $scope data from within an http.get callback

Would someone be able to assist me with storing the data returned by the $http.get function in a $scope variable for use in my ui-grid control? I have tried the code below but seem to be missing something simple. I just can't figure out what it is: ...

Assign object properties to a constant variable while validating the values

When receiving the features object, I am assigning its values to constants based on their properties. const { featureCode, featureSubType, contentId, price, family: { relationCountsConfig: { motherCount, fatherCount, childrenCount }, max ...

Navigation guard error: Caught in an infinite redirect loop

I have set up a new vue3 router and configured different routes: const routes = [ { path: "/", name: "home", component: HomeView, }, { path: "/about", name: "about", component: () => ...

Is there a way to specify the dimensions of the canvas in my image editing software based on the user-input

Here is the code and link for my unique image editor. I would like to allow users to enter the desired width and height of the selection area. For example, if a user enters a width of 300 and height of 200, the selection size will adjust accordingly. Addit ...

Is it possible to verify the HTML of a webpage once AJAX actions have been carried out?

Currently, I am working on a web application where I am utilizing AJAX and JQuery to add and modify HTML elements. Everything seems to be functioning well, but I want to ensure that everything is running smoothly behind the scenes. When I inspect the page ...

Transferring information to the controller and refreshing the interface (Single-page design)

I'm stuck on a personal project and could really use some help. If anyone has any feedback, it would be greatly appreciated. Thanks in advance. In my index.php file, I have a div with the id main-container. Inside this container, there are two separa ...

Experiencing a hiccup in React while attempting to play an mp3 file

My project includes the following code snippet, with an example mp3 file and npm package: https://www.npmjs.com/package/react-sound import React from 'react'; import Sound from 'react-sound'; class CustomSound extends React.Component ...

Incorporating an HTTP-based IFRAME into an HTTPS web address

My situation involves a PHP application running in HTTPS mode, within which there is an iframe containing an HTTP file. Both the parent and the iframe exist within the same domain. Strangely, I am unable to access the iframe source using HTTP. Is there a ...

What causes the variance in outcomes between employing a literal string versus a local variable?

Here is a loop that I am working with: for (var key in criteria) { var exists = Object.keys(item).some(function(k) { return item[k] === "Test"; }) } Initially, this loop functions as expected and returns 15 trues based on the number of i ...

Tips for closing a popup without exiting the entire webpage

I'm facing an issue while trying to create a video playlist using two HTML files (index.html and video.html). In my video.html file, I have set up a popup for playing videos. However, whenever I close the popup or click anywhere on the page, it redire ...

Resolve the issue of autofill data overlapping with field labels

My form incorporates the Canada Post AddressComplete tool, which functions similarly to Google Maps Autocomplete. As you type your address, suggestions appear in a drop-down menu. However, after selecting an address, the text in the Postal Code and City f ...

Can you explain the error message "a.split is not a function" in an Angular context?

My Angular application is encountering an error upon page load. The error message displayed is as follows: angular-amin.js:122 TypeError: a.split is not a function at r (angular-amin.js:186) at m.$digest (angular-amin.js:145) at m.$apply (angular-ami ...

Assistance with JSONP (Without the use of jQuery)

I've been putting in a lot of effort trying to understand how to make a JSONP request, but all the reference materials I find are full of jQuery examples. I can go through the jQuery source code, but I prefer a straightforward and simple example. I&ap ...

Issue with TypeScript in VSCode: "Unable to save file 'x' as it would overwrite the input file."

As I work on improving my JavaScript quality with TypeScript in VSCode, I’m encountering an issue with my tsconfig.json file. It keeps throwing errors when trying to write my .js files, specifically displaying the message: "Cannot write file 'lib/c ...

What is the best way to adjust the autoplay volume to a set level?

I have a page with an audio element that autoplays, but I want to ensure the volume is set to a specific level in case a user has their volume turned up to 100%. Any suggestions on how to accomplish this? Here's the HTML code: <audio autoplay> ...

Utilizing Ajax to send IP addresses and obtain location data

Is there a website or webpage that can be used to input a user's IP address and receive their country or location as plain text? Below is a code snippet demonstrating how I attempted to retrieve the user's IP address: I inserted the following c ...

How to obtain the height of the parent screen using an iframe

Imagine a scenario where a div contains an image that is set to perfectly fit the height of the screen. This setup works flawlessly, with one exception - when placed within an iframe, the height of the div adjusts to match the content's height rather ...