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

  • SEARCH
  • Home
  • 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 3284236
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:07:55+00:00 2026-05-17T20:07:55+00:00

I have in my database longitude-latitude verticies from user-defined polygons. My questions is: how

  • 0

I have in my database longitude-latitude verticies from user-defined polygons. My questions is: how do I recreate and display them on a map now? This is quite easy to do with the Google Maps API, but I can’t find any documentation or examples on how to do this with OpenLayers. Has anyone had any experience doing this?

  • 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-05-17T20:07:55+00:00Added an answer on May 17, 2026 at 8:07 pm

    After a lot of experimenting, I found out how to do it:

    let sitePoints = [];
    let siteStyle = {
      // style_definition
    };
    
    let epsg4326 = new OpenLayers.Projection("EPSG:4326");
    for (let i in coordinates) {
      let coord = coordinates[i];
      let point = new OpenLayers.Geometry.Point(coord.lng, coord.lat);
      // transform from WGS 1984 to Spherical Mercator
      point.transform(epsg4326, map.getProjectionObject());
      sitePoints.push(point);
    }
    sitePoints.push(sitePoints[0]);
    
    let linearRing = new OpenLayers.Geometry.LinearRing(sitePoints);
    let geometry = new OpenLayers.Geometry.Polygon([linearRing]);
    let polygonFeature = new OpenLayers.Feature.Vector(geometry, null, siteStyle);
    vectors.addFeatures([polygonFeature]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have latitude and longitude saved inside a database. I have the bing map
I have a database of user submitted latitude/longitude points and am trying to group
I have an address database and I tried to find latitude and longitude using
i have latitude and longitude columns in location table in PostgreSQL database, and I
i have an database with the values of latitude and longitude. i would need
I have in my MySQL database both longitude and latitude coordinates (GPS data). It's
I really need your help. I have a database with latitude and longitude data,
for example i have a MySQL database that contains latitude and longitude, how do
I have a database of geolocalized objects: id latitude longitude I am querying the
basically I have a database that is setup in Longitude and Latitude. I have

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.