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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:49:58+00:00 2026-06-11T00:49:58+00:00

I want to use decimal Lon and Lat like Google Maps uses. But it

  • 0

I want to use decimal Lon and Lat like Google Maps uses. But it seems I need to transform the LonLat object in OpenLayers, e.g.

    var map, layer;
    function init(){
        map = new OpenLayers.Map('map');
        layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
        map.addLayer(layer);
        map.setCenter(
            new OpenLayers.LonLat(-1.60400390625, 54.07228265560386).transform(
                new OpenLayers.Projection("EPSG:4326"),
                map.getProjectionObject()
            ), 6
        ); 

        var markers = new OpenLayers.Layer.Markers( "Markers" );
        map.addLayer(markers);

        var size = new OpenLayers.Size(21,25);
        var offset = new OpenLayers.Pixel(0,0);
        var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);
        markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(-1.60400390625, 54.07228265560386).transform(new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()),icon));           
    }

Each time I place a marker the position needs to be transformed to EPSG:4326. Is there a way to tell the map to always use this projection?

  • 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-11T00:50:00+00:00Added an answer on June 11, 2026 at 12:50 am

    Whether you can set the projection on a map or not, depends on which service you are using for the base layer. As far as I know, OSM only provides its rendered tiles in EPSG:900913, so there is no way around transforming your coordinates before adding them to the map. You could search for a service that provides its tiles in multiple projections, but I haven’t seen one that is free to use so far. An alternative would be to render your own tiles in the needed projection and provide them through your own tile server.

    Let’s suppose you have such a map, you can change the projection using OpenLayers.Map.setOptions() like this:

    map.setOptions({
        projection: "EPSG:4326"
    });
    

    But you may also need to set some projection related properties, like maxExtent etc. See this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to format number entered by user in dutch format. ie. use decimal
I want use BYTE_ORDER macro in my Xcode project but i can't because i
I want use JQuery mobile for the front-end of my mobile application, but I
If I want to use a decimal literal in code, I have seen that
I don't want a currency symbol, but I have values like; 4900 4900 4900
I'm trying to do what seems like a basic cast of int to decimal,
I want to use double up to just 2 decimal places. i.e. it will
I need to validate some textbox input. I want to use a regex. The
I want to store timezones but not in the timezoneoffset datatype. Should I use
I want to use Decimal class in my Python program for doing financial calculations.

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.