Importing a geoJSON object directly onto Google Maps V3

I am currently working on developing a map using floor plans stored in mongodb. Instead of saving the JSON data into a file and calling it with

map.data.loadGeoJson('myfile.json')
, I want to create an object directly for better efficiency. Below is an example:

var tempObject = {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {
          "letter": "G",
          "color": "blue",
          "rank": "7",
          "ascii": "71"
        },
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [// Coordinates array here]
          ]
        }
      }
    ]
  };


  map.data.loadGeoJson(tempObject);

But this method doesn't seem to work as expected. Is there a different approach to load all data from a single object, or do I have to resort to saving files or creating individual polygons using google.maps.Polygon()?

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

What is the best way to access a nested element within a JSON string using Scala?

Currently, I am utilizing Scala to parse JSON with a specific structure: { "root": { "metadata": { "name": "Farmer John", "hasTractor": false }, "plants": { "corn": 137.1 ...

Unleash the power of unescaping Unicode strings with System.Text.Json in dotnet

When using JsonSerializer.Serialize(obj), it produces an escaped string; however, I am in need of the unescaped version. Here is an example: using System; using System.Text.Json; public class Program { public static void Main() { var a = n ...

What is the behavior of a variable when it is assigned an object?

When using the post method, the application retrieves an object from the HTML form as shown below: code : app.post("/foo", (req, res)=> { const data = req.body; const itemId = req.body.id; console.log(data); console.log(itemId); }) ...

Creating a PHP script that processes a MySQL query and fetches a group of data as an array, which is

I have the following MySQL Table: +----+------+-------+--------+-------+-------+ | id | col1 | col2 | col3 | col4 | col5 | +----+------+-------+--------+-------+-------+ | 1 | a | Cat A | Joe | data1 | data2 | +----+------+-------+--------+--- ...

receiving no response from the PHP server

Hello everyone, I'm currently working on integrating PHP web services into my Android application. Below is a snippet of my Android code: userName = userNameField.getText().toString(); passWord = passWordField.getText().toString(); try { JSONObject ...

Dropdown menu not populating with options in AngularJS ngOptions

It's puzzling to me why the dropdown menu is not being populated by ng-options. Despite JSON data being returned from the service and successfully logged in the controller, ng-options seems to be failing at its task. <tr class="info"> <td ...

Fetching data from an uploaded file and transmitting it to a specified URL

<? if(isset($_POST["submit"])) { $f_name = $_FILES["filetoupload"]["name"]; $f_tmp = $_FILES["filetoupload"]["tmp_name"]; $store = "uploads/".$f_name; if(move_uploaded_file($f_tmp,$store)) echo "file uploaded successfully"; echo"<br>"; ...

Retrieve the output of a function once the function has completed

I'm facing an issue where I need to wait for a function to return a value from my MySQL table before using it as a return for my const ProjektNameIntentHandler. Here is the relevant code snippet: const ProjektNameIntentHandler = { canHandle(handlerIn ...

Could it be possible that my code is preventing any duplicate entries in a table?

Currently, I am in the process of developing an application that utilizes JSON data which is regularly updated with fresh JSON data from a Delphi application that I am concurrently working on. Below is the stored procedure I have created to import this inf ...

Utilize Angular Resource to efficiently transfer intricate data types to ServiceStack

I'm encountering an issue while trying to send complex types with Angular Resource to my ServiceStack backend. On the frontend, the code looks like this: MyResource.get({ Data: { countries: ["DE","CH","AT"] }, SomeMoreParams: "hi" }); Here i ...

Storing an array in a file using Swift

In the process of developing an application, I have successfully implemented functionality to: Check for an internet connection; Receive a JSON file from the server and store the data in a file if the server is reachable; Read from the file if the connec ...

Using jQuery to send JSON data through AJAX to PHP

I'm attempting to utilize jQuery AJAX to send JSON data to a PHP file. My goal is to extract the values and IDs from multiple child elements, create a JSON object with this data, and then transmit that object to a PHP file for processing and insertion ...

What is the process for transferring a Pulumi Output<T> to the container definition of a task in ECS?

When creating a generic ECS service that deals with dynamic data, it is important to note that the containerDefinition within a Task Definition must be provided as a single valid JSON document. The code snippet for this setup looks like: genericClientServi ...

Trapped in the Google Maps labyrinth (Angular)

Hey there everyone! I'm currently working on an exciting angular application that integrates the Google Maps API. The goal is to create a feature that shows the 20 closest coffee shops based on the user's current location. However, I seem to be r ...

Having trouble retrieving information from a nested JSON array within a JSON object using JavaScript

I am facing a challenge with extracting specific information from a JSON object that contains an array nested inside. Even though I have experience working with JSON arrays, this particular object is proving to be tricky. For example, when attempting to r ...

Generate a dynamic JSON object based on grouped data from a DataFrame by a specified column name

I am currently working on a project that involves creating datasets using the columns of a dataframe. The columns I have to work with are ['NAME1', 'EMAIL1', 'NAME2', 'EMAIL2', NAME3', 'EMAIL3', etc]. ...

Retrieve the key name that contains a specific value in JSON data

Currently, I am utilizing the JSONAta library to navigate a complex object. My goal is to extract the keys that meet specific conditions. { "properties": { "WTID": { "pattern": "referen ...

Convert a single JSON array into two separate jquery arrays

I'm currently working on extracting data from a JSON file using my jQuery script. Below is my jQuery code snippet: $.ajax({ type: "GET", url: "settings.json", dataType: "json", cache: false, error: function(){ $('.sl ...

What is the best way to eliminate the additional square bracket from a JSON file containing multiple arrays?

Seeking JSON data from an array, I encountered an issue with an extra square bracket appearing in the output. After attempting $episode[0] = $podcast->getPodcastByCategoryId($id);, only partial data was retrieved, corresponding to the first iteration. ...

Contemplating the protection of an Android online platform

In the process of developing an Android app to connect to a http server, I have implemented a web service that sends JSON data to a PHP script on the server. This PHP script then accesses the desired database and inserts the JSON objects. However, my focu ...