OpenLayers with geowebcache - WMTS vs. WMS - gis

I am using OpenLayers 3 with GeoWebCache (GeoServer). Are there any performance differences between WMS and WMTS when using GeoWebCache?
(Now I'm using url http://localhost:8080/geoserver/gwc/service/wms and I want to know if it will be faster to use WMTS instead)

Related

How to display a Layer Group in QGIS Server

I want to display layers with QQgis server, but the group layer doesn't get displayed, instead I get a bad request response from the server :
the request : http://myserver/cgi-bin/91589/qgis_mapserv.fcgi?SERVICE=WFS&VERSION=2.0&REQUEST=GetFeature&typename=94043_CADASTRE&SRSNAME=EPSG:2154&OUTPUTFORMAT=GeoJSON
<pre>
<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" version="1.2.0">
<ServiceException code="RequestNotWellFormed">TypeName '94043_CADASTRE' unknown</ServiceException>
</ServiceExceptionReport>
</pre>
And here is a peek at the layer section in Qgis :
WFS services do not have any concept of layer groups which are a purely WMS feature.
You should either use a WMS request or request each layer separately with the WFS.

Get {X} and {Y} values for TMS service of a bounding box

In this tread it is explained how to download and merge tiles from a XYZ maps service.
How can I find out the X and Y values of a region defined by a special bounding box, e.g. 9.477733,53.485664,9.8856,53.602995 (CSV format)?
Am I right, that these values are the same for all XYZ maps services like Google Maps and OpenStreetMap?
Thanks for your answers!
Depends what you are trying to do. For a tile map server google and bing are not compatible with the TMS standards, You'll need to convert the values. In my case, I was using MapBox on my web app and GoogleMaps on mobile.
In my python server code I had to add an if statement that goes something like this:
#application.route('/your_url/<int:idx>/<int:zoom>/<int:column>/<int:row>.png')
def map_overlay(idx, zoom, column, row):
'''Retrievs a tile from s3 using TMS style tiling
'''
if request.args.get('mobile') == 'true':
row = (1 << zoom) - row - 1
For further info see Converting TMS to Google/Bing/OSM

Google map supports ArcGISDynamicMapServiceLayer from ESRI API?

i believe that in google API version 2, it could eventually call this method out. Moreover they do share or happen to be using the same type of coding.
However in version 3, i could not set this layer to the map neither via "layer.setMap(map)" because this esri method does not has this function , nor "map.addOverlay(layer)" because this function belongs to version 2 which has been taken down. can i ask what is the method replacing "map.addOverlay(layer)" in version 3. i have try using custom overlay function, but is comes out as a image which doesn't match the result i want.
** take note : ArcGISDynamicMapServiceLayer is to call a time aware data layer from esri
Have a look at these examples:
http://gmaps-utility-gis.googlecode.com/svn/trunk/arcgislink/docs/examples.html

How add WMS layers with gwt-openlayers?

I'm trying to add WMS layer from remote ArcGIS server to my GWT web app. I'm using gwt-openlayers library.
My code:
MapOptions defaultMapOptions = new MapOptions();
mapWidget = new MapWidget("100%", "100%", defaultMapOptions);
Map map = mapWidget.getMap();
//gNormal = new GoogleV3("Google Normal", gOptions);
//map.addLayer(gNormal);
WMSParams wmsParams = new WMSParams();
wmsParams.setFormat("image/png");
wmsParams.setLayers("1");
wmsParams.setStyles("");
WMSOptions wmsLayerParams = new WMSOptions();
wmsLayerParams.setUntiled();
wmsLayerParams.setProjection("EPSG:3857"); // is it correct setting for WMS layer?
// wmsLayerParams.setProjection("EPSG:102113");
// wmsLayerParams.setProjection("EPSG:4326");
wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
String wmsUrl = "sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer";
arcGis = new WMS("ArcGis", wmsUrl, wmsParams);
map.addLayer(arcGis);
map.setBaseLayer(arcGis);
LonLat lonLat = new LonLat(-84.1,36.4); //USA
lonLat.transform("EPSG:4326", map.getProjection());
//System.out.println("map projection "+map.getProjection());
map.setCenter(lonLat, 3);
add(mapWidget);
I read many articles and SO questions but I still can't solve the problem. My problem is rendering pink tiles on the map instead of normal image. I copied image url as many stackoverflow answers suggested and saw the following:
http://localhost:8084/sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?FORMAT=image%2Fpng&LAYERS=1&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG%3A4326&BBOX=-135,45,-90,90&WIDTH=256&HEIGHT=256
Without localhost:8084 prefix url works fine and shows me small piece of map.
Questions:
1) How get rid from localhost prefix in WMS url? In my code wmsUrl look like sampleserver1... so it's correct. It seems my application adds it's root path to remote url.
2) I read that WMS layers should have the following projection - "EPSG:3857". Is it true? As i mentioned above when I manually put in the browser correct url without "localhost" prefix I saw some image but I'm not sure it's correct. Probably image is shifted.
3) My final goal is adding 2 layers to the map - Google Map layer and WMS layer. Google Map uses "EPSG:900913" as default projection. Could somebody give common tips to place google layer and WMS layer in one map. May be there are some tricks, common mistakes related to projections an so on.
In the wmsUrl variable, you are missing the "http://", that may help.
Pink tiles generally mean that the data source was not found, so this is where you should look for the problem. Try checking the wms URL you are supplying in a wms viewer (e.g. ArcGIS Explorer ).
To your questions:
1)try just adding the http:// to your url, without the localhost
2)A WMS layer can have any projection, it depends solely on the projection in which it was published. Information about a specific WMS's projection should be found in metadata.
3)If the two layers have the same projection, you do not need to do anything. If you want to use two layers in different projections in one map, one of the layers must be reprojected. In pure OpenLayers, this is done by specifying the projection parameter for each layer and then specifying the displayProjection parameter for the map. The layers will automatically be reprojected. However, reprojection takes some time and it increases the load time VERY significantly. It is better to avoid reprojection on-the-fly, if possible. You can either reproject the source data of one of the layers and use reprojected data. Of course, this is not possible for a WMS, so you should consider using a different data source. If you want a background map, you can donwload OpenStreetMap data, reproject them to your desired projection, and then use them with the other WMS you want to use.
Hope at least some of this helps :-)

GIS: How to resize layer using .prj (WKT) projection? (Geographic Coordinate System)

Briefly:
How to parametrize .prj WKT file so that I can perform 7 point tranformation (wiki). I know how false_easting and false_northing params work, but how can I adjust scale? I do not mean scale_factor'
That's the problem description:
I have transportation network (vector layer) saved in non-GIS environment (transport modeling software). Network consists of nodes (points) and polylines (road links). It's done mostly from random backgrounds, regardless any projection, coordinates, etc.
I need to set appropriate projection for the network.
I have accesss to .prj files (if I'm in an say WGS84 projection I can switch to any other projection)
So that's what I'm trying:
I try 7 point Helmert Transformation (http://proj.maptools.org/gen_parms.html). I use towgs84 transformation as a WKT param in .prj file, where I assume that rotation matrix is zero (can I do so?) and I calculate only delta_x, and delta_y, and scale param.
However it will not work. This is my .prj , params in TOWGS84 do not affect transformation:
PROJCS["UTM 17 (WGS84) in northern hemisphere.",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563],
TOWGS84[0,0,0,0,0,0,100000000000000000000000]],
PRIMEM["Greenwich",0],
UNIT["DMSH",0.0174532925199433],
AXIS["Lat",NORTH],
AXIS["Long",EAST],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0]]
So I tried to use false_norting and false_easting params, and those work good, and transform my network proprely, BUT:
It will not chcange scale of my network, only position. So how can I rescale my network using .prj file?
Thanks for any hints
Problem solved: both 'scale_factor' , and UNIT['Meter',%scale_factor] works only if datum changes.
Actually comments at the same problem at gis.stackexchange.com/ here brought me to solution.
Anyway: .prj files, Geo Coordinate Systems, proj4js, EPSG etc. are vary weakly documented: no API, no tutorials, no examples, no refernces.
i.e.
1)not any straighforward description of what EPSG database codes are, and which should be chosen.
2)what +proj parameters should I choose to define projection
3)how to create .prj and what are parameters of specific .prj file elements.
awful programming area!