Search This Blog

Showing posts with label openlayers-3. Show all posts
Showing posts with label openlayers-3. Show all posts

Saturday, 8 August 2015

Switching coordinate order in OpenLayers 3

In this post we will discuss a small, but quite annoying bug/lack of feature in OpenLayers 3. Working with WFS was never one of the strengths of the library. It offers some base classes, but you have to build a complete program on it, with tons of considerations. On the top of that, you can't easily declare the axis orientation you would like to use with your WFS request. If you have tested your WFS app with the OpenGeo demo services, you may have already bumped into this problem. Maybe, you are reading this post, because you would like to fix the issue. Well, the good news are, you can fix it manually with some JavaScript magic, but the are also some bad news. You can't implement a simple validating system on it, as it is not version specific. From some GeoServers the coordinates in EPSG:4326 come in reverse order, while in others they are perfect with the same WFS version.

Saturday, 6 December 2014

Controls and projections in OpenLayers


OpenLayers has a huge advantage as a Web GIS GUI over Leaflet. It can handle any projection, which can be described by Proj.4. Leaflet supports only two projections (the WGS84 and the Web Mercator). These projections are natively supported in most of the GUIs. As Leaflet is a plugin based, modular library, it has a plugin to use Proj.4 capable projections, but it makes a reverse transformation. It transforms the input coordinates with Proj4js from the defined projection to geographic coordinates. OpenLayers on the other side is capable to handle any coordinate system, so the input maps will be rendered in a projection defined by the developer.

Thursday, 27 November 2014

OpenLayers layer management


In the previous post I wrote about layer creation. This is only a part of the capabilities of a good GIS application. A good application can also manage layers in an efficient way. Fortunately, OpenLayers libraries have predefined functions for layer management. They provide a great base to build upon and create dynamic Web GIS applications. Some of the basic tasks of layer management are adding and removing layers, changing layer order, listing rendered layers, and changing layer styles. Off course, they have to do it during the workflow, without reloading the page. I will show a few of these functions with a live example in this post.

Sunday, 23 November 2014

OpenLayers layer creation

Layers are a core concept in every GIS software. They are collections of contiguous spatial data. You can stack layers on each other, perform an operation on them, style them individually, etc. Fortunately, OpenLayers is outstanding with its layer management. Every raster dataset is contained in a layer. For vector data, you can group features to as many layers as you like. Layers can be accessed, modified or removed after they are constructed. As the layer changes, the map object will track the changes, so it will take effect on the visualization, too. In the following post, I will write about OpenLayers layers.

Sunday, 26 October 2014

Getting started with OpenLayers


In the world of open source web mapping interfaces, the biggest and most robust one is OpenLayers. OpenLayers was first released in 2006 by MetaCarta Labs. After 2007, it became an OSGeo project maintained by the OpenLayers Developer Team. It is still under development in these days. The two well-known and widely used branches of this project are OpenLayers 2 and OpenLayers 3. The third version was officially released this year (August, 2014.), and OpenLayers 3.1 has been announced. This also means, that OpenLayers 2 got out of development and the current version is its final form. OpenLayers 3 on the other hand is under constant development, so applications written with it may require frequent maintenance. In return we will get an interface armed with the capability of using up-to-date formats (e.g. TopoJSON), having beautifully rendered maps (WebGL) or in the future providing 3D maps (based on Cesium).
Creative Commons License
Web mapping tutorial by Gabor Farkas is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License