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 8985451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:19:58+00:00 2026-06-15T21:19:58+00:00

some info: I got a main layer (map) which and im drawing lines between

  • 0

some info:
I got a main layer (map) which and im drawing lines between points recived from a JSON result with a Linestring.

(issue)
I followed an example online on how to customize the points i am adding. But this does not work. (Look at the function on the bottom.)

Code:

//'listOfPoints' is an array containing all the point objects.

var pointmap = new OpenLayers.Geometry.LineString(listOfPoints);

    var lastpoint = listOfPoints[listOfPoints.length -1];


    var vesselLayer = new OpenLayers.Layer.Vector(data.bridge_name);

    if (lastpoint != null) {
        var markerLayer = getPOI(lastpoint);
        vesselLayer.addFeatures([pointmap,markerLayer]);
    } else {
        vesselLayer.addFeatures([new OpenLayers.Feature.Vector(pointmap)]);
    }

// Function for creating a marker and returning it to the caller. 

function getPOI(point) {

//This was also tried without the "Style" property. (Only the externalGraphic line)
var temp_feature = new OpenLayers.Feature.Vector(
        point,
        style: { externalGraphic: '/assets/img/marker.png', graphicHeight: 16,     graphicWidth: 16, graphicXOffset:8, graphicYOffset:8  }
    );    

return temp_feature;
}
  • 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-15T21:20:00+00:00Added an answer on June 15, 2026 at 9:20 pm

    At first glance, there’s error in temp_feature definition:

    var temp_feature = new OpenLayers.Feature.Vector(
        point,
        null,
        {
            externalGraphic: '/assets/img/marker.png',
            graphicHeight: 16,
            graphicWidth: 16,
            graphicXOffset:8,
            graphicYOffset:8
        }
    ); 
    

    It’s useful to read and follow API documentation:
    http://dev.openlayers.org/docs/files/OpenLayers/Feature/Vector-js.html#OpenLayers.Feature.Vector.OpenLayers.Feature.Vector

    OpenLayers.Feature.Vector takes three arguments, geometry, object with attributes (which is null in your case, since you don’t have any attributes), and object with style.

    I haven’t tested that code, there may be other problems, too.

    And about general use of JavaScript, there is never such thing as

    style: { externalGraphic: '/assets/img/marker.png', graphicHeight: 16,     graphicWidth: 16, graphicXOffset:8, graphicYOffset:8  }
    

    Object is always defined within brackets:

    {style: { externalGraphic: '/assets/img/marker.png', graphicHeight: 16,     graphicWidth: 16, graphicXOffset:8, graphicYOffset:8  }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got some file sample.mt from client, and when i open info, it reveals
you have some info on an item and you got a list of comment
I read a text file to get some info from it and later on
I am trying to load some info from the database asynchronously. I have a
I'm trying to pullout some info from an external site using jQuery and Adobe
I am trying to read some info from a text file by using windows
I need some help with sending info from a component. I'm not sure how
Is there a tutorial on how to run Ant from Java? I got some
Can someone give me some info/background info on how I might go about writing
Here is some info of the cardiograph app if you dont know it: http://www.spotlightofpeace.com/techarea/photos/cardiograph-application-to-measure-heartbeat-from-iphone-and-ipad-camera/

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.