More

Can I use Openlayers Plugin with a different Datum/Projection?

Can I use Openlayers Plugin with a different Datum/Projection?


There is probably already a post for my problem, but after long searching, I could not find a solution for my issue.

I am working with QGIS und I am using the following projection/datum:MGI / Austria GK East (EPSG:31256) (+proj=tmerc +lat_0=0 +lon_0=16.33333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel +towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 +units=m +no_defs)

I just want to add a layer form the openlayers plugin. For example Google satelite. the Google satelite uses the following projection/Datum:WGS 84 / Pseudo Mercator (EPSG:3857) (+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +wktext +no_defs).

The Problem that I am facing with, is that I can not get the Google layer in the same projection with my other layers (EPSG:31256)! They are not overlapping correct!

Is there a way to do this?


The only possible solution is to take a screen shot of the Google imagery of your area of interest in CRS:3857 withFile -> Save as image, delete the Openlayers layer, change CRS to the one you want, and add the image(s) as raster.

This makes zooming in look a bit weired, but you can take several images in a higher zoom level, and stitch them together.


To increase precision, some CRS use a datum shift grid. That's the case for IGNF for instance, with a ntf_r93.gsb file to add to the prj.4 call (+nadgrids=ntf_r93.gsb,… ) .

I see that MGI has a shift grid : BEV grid

I hope that'll help.


When working with Google, OpenStreetmap and other maps which use the spherical mercator, you should work in EPSG:3857, i.e. you should project(geotransform) your layer to 3857 projection system.

Qgis will perform this automatically if you enable it in Settings->Options->Coordinate reference System(CRS)


Measuring Distances and Why Projections Matter (+ Practical Examples)

Entering the world of projections can be slightly overwhelming. Basically every projection has advantages and disadvantages. Some may preserve elements of direction, distance or area better or worse than others which is why a careful selection of a suitable projection is so crucial. With this basic tutorial followed by some practical examples we would like to just touch this broad topic and help you understand why and when they matter when you are trying to measure distances or compute areas of interest for analysis.


Download Tools and Tutorial Data

Download Tools

    from Steam if you don't have it already. Used programs:
    • Terrain Processor - fast object population of extents of areal or linear topologies (plant trees, smooth terrain under roads, . )
    • Terrain Builder + Buldozer - terrain project, collect all data and export terrain for Arma 3, terrain preview in Buldozer without clutter
    • Addon Builder - convert terrain data and Binarize for Arma 3

    Set up tutorial data

    • Install Arma 3 Samples from Steam if don't have it already.
    • Download the project demo: http://data.bistudio.com/a3data/TerrainProcessor_Demo.zip(temporary link)
      • (Data structure: TPDemo Map Sample Data Pack)
      • Unpack the folder map_TPDemo from the downloaded package to the P:a3. Drive is set up by the Arma 3 Tools available on Steam.
      • The sample terrain is utilizing licensed Arma 2 data. Place the required data to P:ca to ensure they work correctly.
        The only needed packages are: A2SM_Data_APL and A2SM_Data_APL-SA

      Using Trigonometry To Place And Orientate Labels

      Geologists display the dip and strike of rock layers on geological maps using a dip and strike symbol, where dip in degrees indicates the maximum angle a rock layer descends relative to the horizontal. However, it is not directly possible in QGIS 2.18, using basic label settings, to place and orient a dip label next to a dip and strike symbol.

      However, there is a way around this issue using Trigonometry and editing the layer’s Attribute Table. This method may be useful for controlling the position and orientation of labels around point features in general. The first step involves adding values to the Attribute Table. First, add these two new columns:

      • Angle – 0° is North and values increases clockwise up to 359°
      • Distance – label distance from a point feature

      You can add Angle and Distance values to these columns manually or use the Field Calculator (see below) to add values if you have lots of points. Also, I chose Map Units (not millimeters) for Symbol Size, Font Size and Distance for my map, as I prefered to keep symbol size, font size and position of labels fixed when zooming in and out.

      Note – I use Strike (Angle) and Label Distance (Distance) in my Attribute Table

      The next step is to control the position of the label around the points using trigonometry. Right click the points layer and choose:

      Properties – Labels – Placement

      Check that Offset From Point is checked and then click the Data Defined Override next to the Offset X, Y boxes and choose Edit. The Expression String Builder will appear. Enter the following expression in the Expression String Builder window:

      The expression takes the angle and distance values from the Attribute Table (edited earlier) and calculates an X, Y label position relative to the point feature. You may also optionally control the angle of a symbol or icon itself via:

      Layer Properties – Style – click Data Defined Override icon – Edit

      Then enter the following expression in the Data Defined Override dialogue:

      Finally, to control the rotation of label text, so text follows the orientation (angle) of a rotating symbol or icon, choose:

      Layer Properties – Labels – Placement – Data Defined – Rotation

      Click the Data Defined Override Icon again and then choose Edit. Enter the following expression in the Data Defined Override dialogue:

      The following geological map of the Old Head of Kinsale in southern Ireland shows the results of the above procedure. We see that the dip labels rotate and currently follow the orientation of the dip and strike symbols (note that the points are at the intersection of the T symbol).

      Geological Survey of Ireland – Creative Commons Attribution 4.0 license

      You may have several different symbols, of various sizes, each requiring an appropriate label distance expressed in the Attribute Table. It took me a few tries before I found the right distances for my geological symbols, from 90 to 230 meters distance depending on the symbol size and type.

      Lastly, the expressions “Angle” – 90 and (“Angle” – 90) * -1 were necessary in my case because I needed to place my labels next to the dip and strike symbol’s barb. You may need to use a different expression e.g.Angle” and (“Angle”) * -1, or a value other than 90° depending on the symbol used and the prefered label placement location. Some trial and error is may be required to find the correct label position.


      Mapping Large Areas

      When you’re mapping a large area, like the continental United States, the first concern is making sure that the projection you use is going to represent the entire map area reasonably well. Lucky for you, mapping agencies everywhere have often already flagged a good projection for whatever country you’re interested in, so your first stop is to look for that.

      Let’s take the United States, for example. Here’s the U.S. National Atlas Equal Area projection:

      U.S. National Atlas Equal Area Projection

      The major difference you’ll probably notice off the bat between this and Mercator is the border with Canada in the western half of the United States: Instead of being a straight horizontal line, it’s curved. By solving the mathmatical problem of how to flatten the globe differently, Albers does a much better job of showing each state in proportion to all the others than something like Mercator.

      So problem solved, right? Why don’t we just all use Albers? Because the U.S. National Atlast Equal Area projection is heavily optimized for the characteristics of the United States: wider east to west than north to south. South America, for example, is the opposite and requires different projections.

      If you have looked around and still haven’t found a good answer, you can also try out this amazing tool to help choose a projection.


      Walkthrough: Serving and styling a WMS with GeoServer

      In this walkthrough, you'll get some practice serving some geographic data as a WMS using GeoServer. The exercise will progress from simple to complex in the following manner:

      • Serving a single layer as a WMS using the default styling
      • Applying a style to the WMS using an SLD
      • Viewing the WMS in QGIS

      The next walkthrough will go into more depth with SLDs and group layers.

      As you complete these walkthroughs, think of some of your own data you'd like to serve as a WMS in fulfillment of the Lesson 4 assignment. You won't be required to use this WMS in your term project, but you can if you choose.

      Serving a single layer as a WMS using the default styling

      Let's start out by serving a single layer as a WMS. We'll stick with Philadelphia in this lesson so that we can eventually pull in some of the base layers that we clipped and projected previously. The first layer we'll work with is a polygon dataset of Philadelphia neighborhoods that I derived from a Zillow.com shapefile.

      1. Download Neighborhoods.zip and extract the contents into your Philadelphia data folder so that the files can be found at a path like c:dataPhiladelphiaNeighborhoods.shp. This data is already projected into EPSG:3857 and it doesn't need to be clipped for this exercise.
      2. Start GeoServer by clicking All Programs > GeoServer > Start GeoServer.
      3. Start the GeoServer Web Admin Page and log in with your administrator account (the username is probably "admin" with password "geoserver"). Refer to Lesson 2 if you need a refresher.

      When you are finished, click Save. Note that you can create this store even though there are raster files in it. If you wanted to use the rasters, though, you would have to specify a separate store in GeoServer.

      Styling the WMS using SLDs

      The above WMS indeed contains the Philadelphia neighborhoods, but there are no labels and we didn't get to choose the color scheme. In this part of the walkthrough, you'll use an SLD to apply a blue outline and labels with no fill. This will allow the neighborhoods WMS to act as a thematic layer that you can place on top of other base layers.

      To work with SLDs in GeoServer, you first add the SLD under the Styles list. Then you can go back into the layer properties and apply the style. Decoupling the styles and the layers in this fashion allows you to reuse a particular style on multiple layers.

      The first thing we'll do is prepare the SLD, starting with an existing sample and then modifying it to meet our needs.

      1. Open the SLD Cookbook to the Polygon with styled label example. This comes pretty close to what we want, so we're going to start with it.
      2. Click View and download the full "Polygon with styled label" SLD. You will see the XML of the SLD example.
      3. Use your browser's save option to save the page contents with a file extension of .sld. For example: polygonwithstyledlabel.sld

      You can come back to this page any time to make edits to your SLD. Any services using the SLD will be immediately updated.

      This is still not perfect (notice the many labels overlapping features), but it is progress, and it has opened the door to editing the style through other XML options defined in the SLD and GeoServer documentation.

      In general, labeling is a tricky subject with web maps. Labeling is computationally intensive and relies on complex rules that can slow down the map drawing. The labeling rules available with GeoServer and WMS are relatively simple compared to the logic used by a desktop program like QGIS or ArcMap. Because of these issues, web map authors sometimes rely on alternative mechanisms such as interactive popups or text that changes dynamically depending on where you point or click the mouse (or tap the display). Fetching this information on demand is faster than waiting for thousands of labels to be placed and eliminates the reliance on complex labeling algorithms.

      Viewing the WMS in QGIS

      There are lots of clients you can use to view a WMS. You already saw how your WMS could be previewed with OpenLayers. Now let's take a few minutes to see how QGIS works with WMS layers. This is important if you want to bring web services into your desktop maps as backgrounds or thematic layers.

      1. Launch QGIS, start a new project, and click the Add WMS/WMTS Layer button.
      2. In the Layers tab, click the New button. Here you will put the properties of your GeoServer workspace. All the layers in your workspace are exposed through the same root WMS URL.
      3. Enter the name as Geog585 Layers and the URL as http://localhost:8080/geoserver/geog585/wms as shown below. Notice that the geog585 in the URL is the name of the workspace you created in GeoServer.

      This is a good time to use the OpenLayers plugin that you may already have installed in Lesson 3. At the end, I'll also explain how you can do the same thing without the OpenLayers plugin.

      If you don't have the OpenLayers plugin installed, you can still add the Stamen Watercolor map. You do this by pointing QGIS at the basemap image tiles on the Stamen servers. First, make sure your Browser panel is open. If necessary, click View > Panels > Browser. In the list of layer types in the Browser panel, find the XYZ Tiles item, right-click it, and choose New Connection. Enter the Name as "Stamen watercolor" and enter the URL as http ://c.tile.stamen.com/watercolor///.jpg . This is the generic URL structure for the Stamen Watercolor tiled map images (more on this in Lesson 5), where x is the column, y is the row, and z is the zoom level of the tile to fetch at any given map extent. Click OK, and then drag and drop the resulting Stamen Watercolor layer down into your map layer list in the Layers panel. See this post for tips on adding all kinds of other basemap layers to QGIS 3 in the same fashion.

      Congratulations! You have just made a (somewhat strange) "mashup" that brings in web services from two different servers. In future lessons, you'll learn how to do this in a more practical fashion in a web application.

      QGIS not only displays WMS layers it can also help you create SLDs. In the next walkthrough, you'll make some SLDs using QGIS and learn how to group WMS layers together using GeoServer.


      6 Comments

      Hi,
      Your page is quite informative. I am clearly trying to do something way out of my league. It seems I seem an astronaut and a cartographer for this one!

      I’m trying to load WGS-84 coordinates into my render_list for an OpenStreetMap server I have. I can’t reconcile what numbers to use…

      How does one find the proper Lat and Long conversion? (I’m trying to limit my server to rendering specific cities in depth.
      I hope you can assist, thanks for your time:)

      Thank you for the information. It is so useful for my report!!

      Thanks, for this information it really enhanced me.

      Where can I get data set for various datum?
      Thank you

      i found the information very useful for applying NOC from Airport Authority of India

      I found the information very useful and beneficial to our survey work in the forest and will soon come up with a more comprehensive map output.


      MAPublisher: Enhanced Grids and Graticules Allows You to Share Grid Settings

      If you haven’t noticed yet, we released an enhanced version of the Grid and Graticules tool (MAPublisher 8.7 and higher). With the new Grid and Graticules tool, you will find that you can export grid settings and save them. Most importantly, these grid settings files can be shared and imported to another document.

      Once a grid is created, save the settings to a *.cfg file. Two configuration files are created per grid: grid settings and label settings.

      Grid settings configuration files store information for all related grid options (e.g. ticks, intervals, offsets, borders). Label settings configuration files store information for all related label options (e.g. axis labels, fonts, styles), even for multiple grids. Label settings are saved with _labelData suffixed to the file name.

      Share the files and load the *.cfg file in the Grid and Graticules dialog box.

      Some of the major functions of the new Grid and Graticules tool are adding tick marks along border lines, placing cross hair symbol instead of lines for grid/graticule lines, styling lines and text more flexibly, and having more label options available. You can share the settings by exporting one and importing to another document as well. You can make a set of grid lines looking like this below.


      Defining Undefined Layers

      Now that you know the geographic coordinate system of the County feature class, you will need to define it, so that ArcGIS knows, as well. Please note that the geographic coordinate system and projection must be defined based on metadata provided from the data source itself. If you cannot locate such metadata, you should contact the provider of the data for the information. You cannot simply guess or decide which projection to use when defining the data (though, occasionally, you may have to resort to educated guesses and trial-and-error when metadata absolutely cannot be tracked down from the data provider.)

      1. On the ribbon, click the Analysis tab.
      2. In the Geoprocessing group, click the Tools button to open the Geoprocessing pane on the right.
      3. In the 'Find Tools' search bar, type "define projection".
      4. Click the Define Projection tool to open it.
      5. Use the ‘Input Dataset or Feature Class’ drop-down menu to selectCounty.
      6. For the 'Coordinate System', to the right of the drop-down menu, click the Select coordinate system button.
      7. In the Coordinate System window, expandGeographic coordinate system > North America > USA and territories.
      8. ClickNAD 1983 and clickOK.
      9. Ensure your Geoprocessing pane appears as shown below and clickRun at the bottom of the Geoprocessing pane.

      Notice that the County layer has been projected onto the correct location of Harris County.

      1. In the Catalog pane, double-click the County layer name.
      2. Click the Source tab and expand the Spatial Reference section.

      Notice that the geographic coordinate system is now listed, since you have defined the feature class.


      Is there some reason why a

      Is there some reason why a page that is supposed to document a requirement related to "projection support" cannot have a link or some kind of information explaining what a "projection" is?

      Hi Sheldon,A map projection

      A map projection is the way information on a spherical globe (three dimensions) is displayed on a two dimensions surface.

      You have many kind of different projections, depending on the map you want to display it's better to use a projection or another.

      Why ? Easy, for some countries, it's better to use conical projection instead of cylindrial.
      Example, for the North America area, it's better to use a conical projection, you'll get less deformation than in the cylindral projection.

      I think you'll find more details on the wikipedia page.

      I don't work in GIS and I think that Augustus will probably explain that in a better way as he's working in GIS every day.

      Update your Geofield

      If your Geofield is 7.x 1.1 then update that module to 7.x-2.x dev

      Patch for Geofield is "work in progress"

      ________________________________________
      Cando Image GmbH
      Else Züblinstrasse 115 :: CH-8404 Winterthur :: Switzerland

      I'm having this error

      Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. in openlayers_get_projection_by_identifier() (line 977 of /Applications/XAMPP/xamppfiles/htdocs/drupal/sites/all/modules/openlayers/openlayers.module)

      Not sure where I should add the patch.

      I'm getting the same error as

      I'm getting the same error as in the post above when clicking on the /locator link in the OpenLayers Locator proximity search view.

      Not sure what to do next as this has been reported already in the http://drupal.org/node/1960538 which leads to http://drupal.org/node/1943968. This patch however this does not apply cleanly against the latest version of openlayers (beta 5).

      Is the patch listed 2 posts ago not relevant this this exact issue? I did try patch that against geofield 1.1 stable and it returned a hunk offset warning.

      Brick wall hitting at present can anyone shed some light on how to get rid of this error message? Thanks

      Possible workaround

      The nodes that I need to map have addresses picked up by the Location module. I plot them on a map using Views and custom OpenLayers maps, based on the latitude and longitude fields generated by Location.

      After the recent update borked all my maps, I finally figured out a manual workaround. First, I chose one of the included sample maps that was closest to the custom map I was updating. In my case, it was example_google. I clicked "Export" on this map and did a text search for "EPSG" and found

      Then I clicked "Export" on my custom map and looked for the same section in the export code. I replaced the values for 'projection' and 'displayProjection' with the values from the example map, then copied all the modified custom map export code and imported it back into the site via /admin/structure/openlayers/maps/import (checking the box for "Allow import to overwrite an existing record"). I clicked "Save" on the next screen, and my maps started working again.

      Had to repeat this for each of my custom maps . tedious, but better than the white screen error my users were getting when they tried loading any page with a map on it.

      Thanks! This has helped.

      Thanks! This has helped. Although I just get blank spaces where the maps should be, at least they don't break the page with an error.

      1. Go to list of OpenLayers maps
      2. Click 'Export' on map you want to fix.
      3. Add in the 'EPSG:' to your projection info.
      4. Copy the modified map export.
      5. Go back to the OL maps list.
      7. Click 'Import.'
      8. Paste in your modified map export and select the overwrite box (this will replace the map you just exported from).

      I did an installation from

      I did an installation from scratch, created a new content type, added a geofield field and an openlayers map and I still having the same error

      Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. in openlayers_get_projection_by_identifier() (line 996 of /Applications/XAMPP/xamppfiles/htdocs/propiedades/sites/all/modules/openlayers/openlayers.module)

      I suggest you to use Geofield

      I suggest you to use Geofield 2.x (development version).

      Thanks

      7.x-2.0-alpha2+9-dev from June 15, 2013 - 09:19 worked for us.

      The problem still exists

      When I try to edit any map in Open Layers, the following error apperars:
      Exception: Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. a openlayers_get_projection_by_identifier() (línia 996 de /home/fidelproves/www/bibues/sites/all/modules/openlayers/openlayers.module).

      Same here!

      I have the same problem when adding a new map,
      any help would be awesome.
      thanks!

      An upgrade to 7.x-3.x-dev

      An upgrade to 7.x-3.x-dev solved it for me.

      Still not working!

      i just installed the version you said, but now it won't even let me enable the module.
      any ideas?

      7.x-3.x is not ready for

      7.x-3.x is not ready for production yet and almost no module is ready for it !

      Where to make the changes

      The required changes shown in the preceding paragraph must be done in "geofield.openlayes.inc", found in the "geofield" module in "sites / all / modules / geofield".

      Thanks!

      To be automated

      I'm trying to build events with geographic position using openlayers and leaflet for display.
      I could create one using openlayers-7.x-2.0-beta3.tar.gz but openlayers-7.x-2.0-beta5.tar.gz produces an error despite tried to do what is proposed :

      ------------------
      Key layer_type, file is missing in in the plugin definition of the layer type openlayers_layer_type_MY_MODULE. The layer will be disabled.
      Message d'erreur
      Exception : Projection 900913 lacks an authority code. Read http://drupal.org/node/1944074 for hints. dans openlayers_get_projection_by_identifier() (ligne 996 dans /home/patrick2/landshoping/sites/all/modules/openlayers/openlayers.module).
      ------------------

      I have Drupal 7.21, openlayers-7.x-2.0-beta5.tar.gz and geofield-7.x-1.1.tar.gz

      This is the diff between the before and after the change in geofield.openlayers.inc :

      80,81c80,81
      < 'projection' => '900913',
      < 'displayProjection' => '4326',
      ---
      > 'projection' => 'EPSG:900913',
      > 'displayProjection' => 'EPSG:4326',
      149,150c149,150
      < 'projection' => '900913',
      < 'displayProjection' => '4326',
      ---
      > 'projection' => 'EPSG:900913',
      > 'displayProjection' => 'EPSG:4326',
      196c196
      < 'projection' => array('900913'),
      ---
      > 'projection' => array('EPSG:900913'),

      If I was allowed any comment, I would express my astonishment about the amount of hardcoding in that file and about the way to use projections defined in the openlayers configuration tabs.

      Long time Linux user, new to Drupal, trying to get help and help in return.


      Watch the video: Map Projections Explained - A Beginners Guide