Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9256767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:01:45+00:00 2026-06-18T12:01:45+00:00

I am drawing a list of zip code areas in google maps and I

  • 0

I am drawing a list of zip code areas in google maps and I am trying to write a label with the zip code over the area. I can do this just fine, except that I am using the centriod of the area to position the label, but some areas are shaped irregularly and the centroid falls outside the area itself. Here is an example of what I mean:

enter image description here

Watch zip code 81151, how it shows up on top of the area for zip code 81123 rather than on top of his own area.

Does anyone know of a better algorithm to correctly position the zip code on top of an irregular area, rather than using the area’s centroid?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:01:46+00:00Added an answer on June 18, 2026 at 12:01 pm

    You can use the google.maps.geometry.poly.containsLocation and google.maps.geometry.spherical.interpolate functions.

    for example. get a boundary point and the center point of the polygon and use the function ‘google.maps.geometry.spherical.interpolate ({centerpoint}, {bundaypoint}, {distance})‘
    then you verify that the resulting point is in the area of ​​the polygon with
    ‘google.maps.geometry.poly.containsLocation ({resultPoint}, {polygonObject})‘ function.

    GetBounds function:

    if (!google.maps.Polygon.prototype.getBounds) {
                google.maps.Polygon.prototype.getBounds = function (latLng) {
                    var bounds = new google.maps.LatLngBounds();
                    var paths = this.getPaths();
                    var path;
                    for (var p = 0; p < paths.getLength() ; p++) {
                        path = paths.getAt(p);
                        for (var i = 0; i < path.getLength() ; i++) {
                            bounds.extend(path.getAt(i));
                        }
                    }
                    return bounds;
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Drawing a blank on this, and google was not helpful. Want to make a
I'm writing a drawing program. I'm trying to take an ordered list mouse positions,
I'm drawing a blank on this one and can't seem to find any previous
I am trying what I thought a simple thing: drawing lines of a list
i am having this error java.lang.ClassCastException: [Ljava.lang.Object; in drawing a route from list of
I love the new Drawing library for Google Maps v3.7, but I have the
I've got a list of System.Drawing.RectangleF objects that all overlap the same RectangleF object.
This drawing shows a tree of parent-child relationships. It is directed, without cycles. A
While drawing graphics in 2D, how can I handle the depth of a picture
I have the following drawing code: [[NSColor redColor] set]; NSRect fillRect = NSMakeRect(bounds.size.width -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.