how to stop map from disappearing with Google Maps API?
#1
I have a map that works up until the point that I change the width and height of this red rectangle I want to create. It doesn't matter if I put it in the initMap() function or not, it does the same thing. The map just disappears from the web page unless the example coordinates are given.

https://pastebin.com/xHkm4wUf

Could someone help me get the map to show up with the red rectangle? I want the rectangle to only encompass one building like a few hundred feet wide and long. But when I try to make any rectangle at all it disappears from my code and so does the whole map.

Here's the example rectangle from Google JS API:

https://developers.google.com/maps/documentation/javascript/examples/rectangle-simple

Why doesn't it work?

Nevermind, I solved it.

Each lat/long value of the rectangle has to be up to three decimal places and no further.

Now I have another issue but I think that can be solved.

I may make another thread for that.



So, I have this code that I am working on and I figured out how to get the rectangle feature working as mentioned in the last thread.

Now, what I want is to make the rectangle fit around a specific building. Should I just look up the coordinates for each building and do it manually? How do I make sure the rectangle only fits around the building I click on?

Here is my updated code:

https://pastebin.com/shvQXUiy


Thanks by the way.



UPDATE:

So, I have this code that I am working on and I figured out how to get the rectangle feature working on a specific building.
Now, what I want is to make the rectangle fit around a specific building that the user clicks on. Should I just look up the coordinates for each building and do it manually? I did it for one building manually and it works. How do I make sure the rectangle fits around each building I click on?

Do I just need to do a bunch of if-statements or something?

Here is my updated code:

https://codepen.io/queuemark/pen/BaoxLrB

Thanks by the way.
#2
(05-09-2020, 06:15 PM)QMark Wrote: I may make another thread for that.

No please, don't do that.
Don't create a lot of threads for the same thing, it is useless and only makes the list of threads LQ.
Specially when you solve the problem by yourself in a couple of minutes.

Put everything on the same thread and create different posts if you have updates or something, now the feed is full of the same assignment of yours.
I am going to delete the other post and put it here, please consider this in the future, thanks you.

EDIT: I cannot even fix it, please merge everything yourself to the original thread, thanks.
#3
(05-09-2020, 06:43 PM)enmafia2 Wrote:
(05-09-2020, 06:15 PM)QMark Wrote: I may make another thread for that.

No please, don't do that.
Don't create a lot of threads for the same thing, it is useless and only makes the list of threads LQ.
Specially when you solve the problem by yourself in a couple of minutes.

Put everything on the same thread and create different posts if you have updates or something, now the feed is full of the same assignment of yours.
I am going to delete the other post and put it here, please consider this in the future, thanks you.

Ok, got it. I will just update this particular thread.

In fact, I have an update right now.
#4
I agree with enmafia. It's fine to make threads, but making several about the same thing is just spammy. It has happened several times in the past couple days, which might be why nobody wants to respond.
#5
(05-09-2020, 11:56 PM)Dismal_0x8 Wrote: I agree with enmafia. It's fine to make threads, but making several about the same thing is just spammy. It has happened several times in the past couple days, which might be why nobody wants to respond.

Ok makes sense. I won’t do it again.

I’m sorry.

(05-09-2020, 06:43 PM)enmafia2 Wrote:
(05-09-2020, 06:15 PM)QMark Wrote: I may make another thread for that.

No please, don't do that.
Don't create a lot of threads for the same thing, it is useless and only makes the list of threads LQ.
Specially when you solve the problem by yourself in a couple of minutes.

Put everything on the same thread and create different posts if you have updates or something, now the feed is full of the same assignment of yours.
I am going to delete the other post and put it here, please consider this in the future, thanks you.

EDIT: I cannot even fix it, please merge everything yourself to the original thread, thanks.

I fixed it. Don't worry about it.
#6
(05-10-2020, 04:01 AM)QMark Wrote: I fixed it. Don't worry about it.

Closing the thread Smile