How to configure mapcache to cache tile from a tms service - configuration

I have a mapserver with mapcache on a server.
I know how to configure mapcache to cache tile from a wms service.
But I can't find anywhere how to configure mapcache to cache tile from a TMS service (openstreetmap https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png)
On the mapcache page https://mapserver.org/mapcache/index.html it is said
"services WMS, WMTS, TMS, VirtualEarth/Bing and Google Maps requests: Supported Tile Services"
I see the line below on https://mapserver.org/mapcache/services.html#mapcache-services
"
To activate the TMS service, add these lines to the mapcache.xml configuration file:
<service type="tms" enabled="true"/>
"
but it's for a client to get tms tile from mapcache, not to mapcache to get the tile from a tms service
I Don't know if it is even possible, because I found no exemple.
To get from a WMS I had the above
<source name="name1" type="wms">
<getmap>
<params>
<LAYERS>layer1</LAYERS>
</params>
</getmap>
<http>
<url>http://an_rul.com/ows/name1</url>
</http>
</source>
<tileset name="name1">
<source>name1</source>
<cache>disk</cache>
<grid>GoogleMapsCompatible</grid>
<format>PNG</format>
<metatile>5 5</metatile>
<metabuffer>10</metabuffer>
<expires>3600</expires>
</tileset>
<service type="wms" enabled="true">
<full_wms>assemble</full_wms>
<resample_mode>bilinear</resample_mode>
<format>PNG</format>
<maxsize>4096</maxsize>
<forwarding_rule name="catch all">
<http>
<url>http://an_rul.com/ows/name1</url>
</http>
</forwarding_rule>
</service>
<service type="tms" enabled="true"/>
For a TMS i'd like to have this sort of thing
<source name="name1" type="tms"> <-- note the tms type i'd like
<getmap>
<params>
<LAYERS>layer1 ?</LAYERS> <-- what layer can I put there ?
</params>
</getmap>
<http>
<url>https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png ??</url> <-- which url should I write ??
</http>
</source>
<tileset name="name1">
<source>name1</source>
<cache>disk</cache>
<grid>GoogleMapsCompatible</grid>
<format>PNG</format>
<metatile>5 5</metatile>
<metabuffer>10</metabuffer>
<expires>3600</expires>
</tileset>
<service type="wms" enabled="true">
<full_wms>assemble</full_wms>
<resample_mode>bilinear</resample_mode>
<format>PNG</format>
<maxsize>4096</maxsize>
<forwarding_rule name="catch all">
<http>
<url>http://an_rul.com/ows/name1</url>
</http>
</forwarding_rule>
</service>
<service type="tms" enabled="true"/>
Thank You

MapCache does not support TMS as a source. See https://mapserver.org/mapcache/config.html
A source is a service mod-mapcache can query to obtain image data.
This is typically a WMS server accessible by a URL. (There are
currently only WMS, WMTS and mapfile as sources, though others may be
added later if the need arises, see Data Sources).
You can use MapProxy instead, it supports TMS sources (tiles) https://mapproxy.org/docs/nightly/sources.html

Related

Google map and firebase don't work together

UPDATE: This is the code that kills functionality of firebase. If I try to download from firebase a couple of seconds after this code (waiting with await Task.Delay, no other code running), it starts sending the code -13000, httpResult = 0 exception. The same request earlier works. Map works.
GoogleMapFragment gmf = new GoogleMapFragment(context, this);
FragmentTransaction ft = activity.FragmentManager.BeginTransaction();
ft.Add(mapLayout.Id, gmf, "my_fragment");
ft.Commit();
I wanted to have google map on layout in the same activity where I work with firebase. Map works, but somehow it interferes with firebase, which work only before creating Google map. Any ideas what can cause this?
Update 2: If I download small file before initializing google maps, I can later use firebase, so I 'solved' the issue in a little dirty way but at least I can continue working. After this 'fix' I get following error in the output but file is downloaded anyway. I must continue digging, for now I hope the worst is over...
error getting token java.util.concurrent.ExecutionException: com.google.firebase.FirebaseApiNotAvailableException: firebase-auth is not linked, please fall back to unauthenticated mode.
Old version of question:
I checked all possible answers here on SO for my question, but nothing brought me to right way. There's quite obvious output telling me that something is wrong, but I have no idea how to solve the issue. There's an answer in this question that one of possible reasons for HttpResult = 0 is that google play version on phone isn't actual enough. I used the method recommended for check and I have Google Play services 11.5.18 installed on phone. I have Xamarin.Firebase.Storage 42.1021.1 (10.2.1) installed and using Visual Studio 2015. Quite often I had to clean and rebuild and it sometimes worked, but not this time. In android properties I have Compile using android version 7.1 Nougat. I created firebase account just recently, not knowing much about this, added it in google console to existing project (as I already use google maps), filled sha1 code the same way I did with maps. Added google-services.json and set it's build action on GoogleServiceJson. No more actions I know about.
Here is my code, I tried various ways to download, upload, but this one seems to be good example:
FirebaseApp fba=FirebaseApp.InitializeApp(context);
firebaseStorage = FirebaseStorage.Instance;
firebaseStorageReference = firebaseStorage.GetReferenceFromUrl("gs://alien-chess.appspot.com");
firebaseStorageReference=firebaseStorageReference.Child("settings.dat");
byte[] bytes = new byte[1000];
firebaseStorageReference.PutBytes(bytes).AddOnFailureListener(new FirebaseFailureListener(this));
Here is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="AlienChessAndroid.AlienChessAndroid" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:label="Alien Chess" android:icon="#drawable/Alien" android:largeHeap="true">
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</application>
And here are what I think are important parts from the output window
Failed to retrieve remote module version: V2 version check failed
Local module descriptor class for com.google.android.gms.firebasestorage not found.
Considering local module com.google.android.gms.firebasestorage:0 and remote module com.google.android.gms.firebasestorage:0
NetworkRequestFactoryProxy failed with a RemoteException:
com.google.android.gms.dynamite.DynamiteModule$zza: No acceptable module found. Local version is 0 and remote version is 0.
....
Unable to create a network request from metadata
android.os.RemoteException
....
StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 0
There isn't much c# sources for visual studio and I can't read that easily recommendations for android studio as they are quite different for unskilled programmers.
Any ideas what other things should I check?

Mysterious EOF error message while updating a SOLR index

I am using atomic update to update meta-data in a SOLR document collection. To do so, I use an external .json file where I record all document IDs in the collection and possible meta-data, and use the "set" command to commit requested updates. But I figured out that whenever the external file is larger than approx 8200 bytes / 220 lines, I get this error message :
"org.apache.solr.common.SolrException: Cannot parse provided JSON: Unexpected EOF: char=(EOF),position=8191 BEFORE=''"
This does'nt seem to be related to the actual content of the file (or possible missing parenthesis or other) as I reproduced it with different databases. Moreover, If I cut the external file into smaller, less than 8000 bytes, updates work perfectly. Has anyone an idea of where this could come from ?
The curl command to update the collection is as follow :
curl 'http://localhost:8983/solr/these/update/json?commit=true' -d #test5.json
The SOLR main configuration file is available after the post. I can provide the json update file if needed. I'm available for any further elements.
Thanks in advance for your help,
Barthélémy
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This is a DEMO configuration highlighting elements
specifically needed to get this example running
such as libraries and request handler specifics.
It uses defaults or does not define most of production-level settings
such as various caches or auto-commit policies.
See Solr Reference Guide and other examples for
more details on a well configured solrconfig.xml
https://cwiki.apache.org/confluence/display/solr/The+Well-Configured+Solr+Instance
-->
<config>
<!-- Controls what version of Lucene various components of Solr
adhere to. Generally, you want to use the latest version to
get all bug fixes and improvements. It is highly recommended
that you fully re-index after changing this setting as it can
affect both how text is indexed and queried.
-->
<luceneMatchVersion>6.6.0</luceneMatchVersion>
<!-- Load Data Import Handler and Apache Tika (extraction) libraries -->
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar"/>
<lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar"/>
<lib dir="${solr.install.dir:../../../..}/contrib/langid/lib" regex=".*\.jar"/>
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-.*\.jar"/>
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="df">text</str>
</lst>
</requestHandler>
<requestHandler name="/dataimport" class="solr.DataImportHandler">
<lst name="defaults">
<str name="config">tika-data-config.xml</str>
</lst>
</requestHandler>
<updateRequestProcessorChain name="langid" default="true" onError = "skip">
<processor class="org.apache.solr.update.processor.LangDetectLanguageIdentifierUpdateProcessorFactory"
onError = "continue">
<str name="langid.fl">text</str>
<str name="langid.langField">language_s</str>
<str name="langid.threshold">0.8</str>
<str name="langid.fallback">en</str>
</processor>
<processor class="solr.LogUpdateProcessorFactory" onError = "skip"/>
<processor class="solr.RunUpdateProcessorFactory" onError = "skip"/>
</updateRequestProcessorChain>
<!-- The default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
<!-- Enables a transaction log, used for real-time get, durability, and
and solr cloud replica recovery. The log can grow as big as
uncommitted changes to the index, so use of a hard autoCommit
is recommended (see below).
"dir" - the target directory for transaction logs, defaults to the
solr data directory. -->
<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
</updateLog>
</updateHandler>
</config>
I don't know if this will solve it for anybody else that runs into this but I ran into this same issue.
My inital command looked like this:
curl http://localhost:8983/solr/your_solr_core/update?commit=true --data-binary #test5.json -H "Content-type:application/json"
Updating it to this solved the problem
curl http://localhost:8983/solr/your_solr_core/update?commit=true -H "Content-Type: application/json" -T "test5.json" -X POST
apparently it has something to do with curl loading the whole file into memory with the first command which causes issues, whereas the second command uses minimal memory.
try editing server/etc/jetty.xml and tweak requestHeaderSize:
<Set name="requestHeaderSize"><Property
name="solr.jetty.request.header.size" default="8192" /></Set>
to something larger than your file limit.

Data Replicator connection string for use with Data Hub

I am trying to set up Invantive Data Hub with Replicator. The default discovery creates entries for Exact Online and others, but there is no entry in settings.xml which shows me how to configure data cache.
This one exists for example:
<connection name="Exact Online (nl)" id="c149becf-01d3-4a58-9ee7-7369f34bdff5" description="{res:itgen_demo_exact_online_combined_nl}" sortingOrder="1000" authentication="Application" userLogonCodeMode="Auto" passwordMode="Auto" createdBy="jbu" createdOn="WS102" creationDate="2017-08-17T13:53:23.9351965+02:00">
<database order="0" createdBy="jbu" createdOn="WS102" creationDate="2017-08-17T13:53:23.9071956+02:00" provider="ExactOnlineAll" connectionString="apiUrl=https://start.exactonline.nl" />
</connection>
The console app has no editor for the settings.xml, so it must be done manually.
How can I configure the Replicator connection string to be used?
Using Google with different keywords, I've found a working setup. First Add a file settings-something.xml in the %USERPROFILE%\invantive.
The give it contents like below:
<?xml version="1.0" encoding="utf-16"?>
<settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3" forcedefault="false">
<group name="Jurriaan" >
<connection name="Exact Online with PostgreSQL Data Cache" dataCacheConnectionString="provider=PostgreSql;connectionString={Server=dbserver;Database=db;User Id=db_owner;Password=db_pwd}" >
<database provider="ExactOnlineAll" connectionString="apiUrl=https://start.exactonline.nl" />
</connection>
</group>
</settings>
It would be handy when there would be a connection editor on Data Hub or at least a sample :-)

Log4j2 RollingFile appender start archiving after N days?

This is the conf I am using at the moment:
<RollingFile name="RollingFileAppender"
fileName="/tmp/test.log" filePattern="/tmp/test-%i.log.gz" ignoreExceptions="false">
<PatternLayout pattern="%m%n" />
<Policies>
<SizeBasedTriggeringPolicy size="100 MB" />
</Policies>
<DefaultRolloverStrategy max="5" />
</RollingFile>
Notice the '.gz' extension that make log4j2 compress the rotated log files.
I would like to keep 5 files uncompressed and start compressing only after that.
Is there a way to start the compression after N rotations?

How can I change an html output of wcf service with my own content?

I wrote a wcf service that uses BasicHttpBinding with some url and a client using this service.
Users should launch a client application and specify the same url that is specified in server endpoint.
However, if a user inadvertently opens this url in a web browser, he/she sees information on how to retrieve service metadata, which is absolutely useless to them.
What should be done in order for him/her to see, for example a help topic?
You need to turn off the publication of the service's metadata.
You can disable it in the Web.config:
<serviceMetadata httpGetEnabled="false" />
You can find more information on MSDN here:
http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicemetadatabehavior.httpgetenabled.aspx
http://msdn.microsoft.com/en-us/library/ms731317.aspx
Of course this will still generate a default landing page if a user manually enters the service's URL in the address bar (e.g.: http://www.examle.com/service.svc). However now it will mention that the metadata is currently disabled.
If you want to customize that page I'd suggest you check out the following thread, it contains a complete code sample on how to set it up:
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/5778651a-b212-438a-b3e8-f7029775d52a/
If you want to have custom help page instead of default one you need to modify ServiceDebug behavior:
<behaviors>
<serviceBehaviors>
<behavior name="...">
<serviceDebug httpHelpPageEnabled="true" httpHelpPageUrl="Your custom page url" />
</behavior>
</serviceBehaviors>
<behaviors>
The same properties also exist for HTTPS and in case of some special requirements you can also control their "binding".