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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:17:53+00:00 2026-05-19T16:17:53+00:00

I have a new marker to place on the map. I use the following

  • 0

I have a new marker to place on the map. I use the following code

var markers = [{'ID':'431','LATITUDE':-33.85491,'LONGITUDE':151.19877}];
var map, layer;

function loadMarkers(POIs){
    var markers = new OpenLayers.Layer.Markers( "Markers" );
    map.addLayer(markers);
    var size = new OpenLayers.Size(10,17);
    var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
    for (var i=0;i<POIs.length;i++){
       var MarkerDef = POIs[i];
       var icon = new OpenLayers.Icon(
         'http://openlayers.org/dev/img/marker-gold.png',
         size,offset);
       var LonLat = new OpenLayers.LonLat(
           MarkerDef.LONGITUDE,MarkerDef.LATITUDE);
       var marker = new OpenLayers.Marker(LonLat,icon);

       markers.addMarker(marker);
    }

    map.addControl(new OpenLayers.Control.Permalink());
    if (!map.getCenter()) map.zoomToMaxExtent();
 }

 function init(){
    OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
    map = new OpenLayers.Map( $('map'), 
      {'maxResolution': 360/512});

    var tiles_url = "http://xxx.xx.xxx.xx:8000/";

    var tilelite_layer = new OpenLayers.Layer.OSM(
      "Mapnik", 
      tiles_url + '${z}/${x}/${y}.png');

    tilelite_layer.attribution = 
      "Data served by "+
      "<a href='http://bitbucket.org/springmeyer/tilelite/'>"+
      "TileLite</a>";

    var osm_official_tiles = new OpenLayers.Layer.OSM(
      "OpenStreetMap Mapnik Server (Mod_tile)");
    osm_official_tiles.attribution = 
      "Map Data CC-BY-SA Openstreetmap.org";
    map.addLayers([tilelite_layer,osm_official_tiles]);

    loadMarkers(markers);
}

The map is drawn correctly and everything is ok, except that the marker does not appear at -33.85491,151.19877. It appears in the middle of the map.
Any suggestions are welcome.

  • 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-19T16:17:54+00:00Added an answer on May 19, 2026 at 4:17 pm

    Fixed the problem, I needed to change the projection:

     var LonLat = new OpenLayers.LonLat( MarkerDef.LONGITUDE,MarkerDef.LATITUDE )
          .transform(
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            map.getProjectionObject() // to Spherical Mercator Projection
          );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to place marker on map view and write a number on marker.
I have written a PHP and javaScript code which will retrieve latitude and longitude
All, I have the following bit of code: function addPoints() { newpoints[0] = new
I'm trying to place a marker on my map and then use the position
I have code straight from Google's dev guide: Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(market://details?id=com.example.android));
I have new problem. My code: .method public static void Main() cil managed {
What is the use of malloc and free when we have new and delete
Problem I have a API V3 map, with a content window for each marker.
The following code works asynchronously. I only have it set up to convert a
I am using google maps api to place markers on a map. The gps

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.