Common issues when attempting to extrude shapes with three.js

As I embark on my journey with three.js, I am encountering challenges when it comes to extruding certain 2D shapes. Currently, I am working with a GeoJSON file that includes data on all the counties in the US. Using d3.js along with a d3.geo.albersUSa() projection, I am transforming latitude and longitude coordinates into X/Y coordinates to create a THREE.Shape, which I then extrude and render. While this process works smoothly for most counties, there are specific cases where issues arise.

The problem arises when attempting to extrude some counties, resulting in the following warning sequences:

Warning, unable to triangulate polygon!
Duplicate point 653.4789181355854:204.0166729191409
Either infinite or no solutions!
Its finite solutions.
Either infinite or no solutions!
Too bad, no solutions.

I'm struggling to pinpoint the exact cause of these errors – as far as I can tell, there is nothing peculiar about the shapes causing these discrepancies. Could this be an issue with the extrusion code within three.js, or perhaps an error on my part?


For example, here are some of the missing counties:

Another observation pertains to the triangular 'hourglass' shapes missing from Texas; these seem to represent counties that were partially rendered as triangles instead of rectangles or squares.

Larger view available here

Apologies for the length of the code provided – I have attempted to condense it as much as possible.

Setup:

/* Initializing the scene, camera, light, and background plane */
var Map = function(params) {
  // Initialize parameters for map creation
};

// Code snippet for rendering

Map.prototype.renderCounties = function() {
  // Fetch GeoJSON data
};

Answer №1

Seems as though the vertices of the polygon are misaligned.

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

Transforming Angularjs into Vuejs

I am currently transitioning a chat application from AngularJS to VueJS, but I am facing some challenges as I am not very familiar with AngularJS. Unfortunately, there is a lack of comprehensive resources available for me to gain a better understanding of ...

unable to retrieve value from JSON object

It appears that I'm having trouble accessing my object variables, most likely due to a silly mistake on my part. When I console.log my array of objects (pResult), they all look very similar with the first object expanded: [Object, Object, Object, Obj ...

Modifying the className attribute is not feasible in JavaScript

Looking to change the class of the first child inside div#programmation <div id="programmationEtat"> <div class="tab-pane ng-scope">...</div> <div class="tab-pane ng-scope">...</div> <div class="tab-pane ng-scope" ...

Deleting an element from a reference array in Mongoose

In my code, I have a User model that contains an array of references to other users: friends : [ { type: Schema.Types.ObjectId, ref: 'User' } ] I am currently struggling with removing an item from this list. Here is what I have attempt ...

What is the best way to loop through a JSON array in Jade and Node.js?

Currently, a JSON array called apiData is passed to the view as data. On the Backend router.get('/', function(req, res) { var data = JSON.stringify(apiData); res.render('gallery', { data: apiData }); }); On the Frontend exte ...

Access to the requested URL has been restricted. Flask is unable to process the method

I have been working on creating a dynamic web service for user login. Utilizing JavaScript, jQuery, and HTML, I aim to make the login process seamless and efficient. However, I have encountered an issue where, upon entering the correct username and passwor ...

Navigating to the specific item that a directive is linked to

I am looking to develop a directive that can be applied to elements to adjust their maximum height to be equal to the height of the window minus the distance from the top of the element to the top of the window. I have attempted it in the following manner ...

Updating JSON data in real time using JavaScript by manipulating MySQL database entries

My database has a mysql structure consisting of the columns ID, NAME, and TYPE. The data is then converted into a JSON format as shown below: [ {id: "1", name: "Snatch", type: "crime"}, {id: "2", name: "Witches of Eastwick", type: "comedy"}, { ...

Retrieving information from a nested array transferred to Javascipt / Jquery through JSON from PHP / Cakephp

Apologies for the basic question, but after hours of research, the examples I've found don't seem to fit the context of my array. I've successfully passed data from my CakePHP server to my jQuery JavaScript, but I'm struggling to make s ...

Is it possible to retrieve an array using axios?

Currently, I am exploring computed properties in Vue.js. One of the computed methods I am working on involves making a request to an axios API to retrieve an array after applying some logic within the promise. computed: { filteredTrips: function () { ...

Text area featuring unique border design, with border color change upon focus?

Currently, I have a text area with borders that are designed in a unique way. However, I am looking to change the border color when the user focuses on the text area. Do you have any suggestions on how I can achieve this effect without affecting the curre ...

Encountering a Circular JSON stringify error on Nest.js without a useful stack trace

My application is being plagued by this critical error in production: /usr/src/app/node_modules/@nestjs/common/services/console-logger.service.js:137 ? `${this.colorize('Object:', logLevel)}\n${JSON.stringify(message, (key, value ...

Error in refreshing JWPlayer page: Plugin loading failure - File not located

I'm implementing JWPlayer on my Localhost environment. Here's the code snippet I'm using: <div id="Player">loading...</div> <script type="text/javascript"> jwplayer("Player").setup({ file: "<?php echo $video[' ...

Having difficulty using JavaScript regex to replace the middle of content?

I am working with a text name[one][1][two][45][text] Through this pattern, I am able to extract the number "45" /(.*?)rows\]\[([0-9]*)(.*)/; Now, my challenge is how can I change the only 45 to a different digit? Using the same pattern and re ...

What is the best way to combine two distinct SVG images?

I recently separated two SVGs that used to be one combined SVG to have better control over the layers. Now I am trying to overlap them in my code. Below is the code snippet: <Grid container direction="row" justify="center" style={{ ...

What is the best way to ensure the height and width of a Next.js image matches the dimensions of the original image?

Currently, I am working on setting up an image gallery with a layout similar to Masonry. This layout involves multiple columns, all with the same width, adjusting based on the viewport width. The height of each item in the gallery is flexible, depending on ...

Extract source, medium, etc. data from __utmz GA with the help of JavaScript

Is it possible to retrieve the campaign, source, and medium that Google Analytics records all at once when the page loads? If so, could I use jQuery to look up the values from __utmz? ...

Using the Strikethrough Feature in React

Is it possible to apply a strikethrough effect to a checkbox's label text when toggled on and off? In my system development process, I've utilized various methods. What modifications should be made in the fComplete method for this feature to wor ...

The most recent version of Autonumeric now permits the inclusion of a decimal point, even if the decimalPlaces parameter

I need to ensure that only whole numbers are allowed in the input textboxes, while also displaying a currency symbol and commas. I am using the most recent version of Autonumeric JS for this purpose. Even after setting the decimalPlaces property to 0, I a ...

AdonisJs experiencing issues with web socket.io functionality

Having trouble with Web socket.io in AdonisJs. I have been using a library called adonis5-scheduler to run tasks within Adonis. Shown below is one of my tasks: import { BaseTask } from 'adonis5-scheduler/build' export default class GetRoulette ...