I have a problem when consulting a WMS using the OSMDroid library, the problem lies in an erroneous generation of the bbox. For example, this is a good url with a correct bbox:
https://www.ign.es/wms-inspire/pnoa-ma?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fjpeg&TRANSPARENT=true&LAYERS=OI.OrthoimageCoverage&srsname=EPSG%3A25829&TILED=true&WIDTH=256&HEIGHT=256&SRS=EPSG%3A25829&BBOX=580836.6437384554%2C4745328.435582805%2C581278.1741512696%2C4745769.96599562
However, using the OSMDroid library, It shows me a white square for the badly generated bboxes:
https://www.ign.es/wms-inspire/pnoa-ma?SERVICE=WMS&request=GetMap&width=256&height=256&version=1.1.1&layers=OI.OrthoimageCoverage&bbox=580836.6437384554%2C4745328.435582805%2C581278.1741512696%2C4745769.96599562&srs=EPSG:3857&format=image/png&transparent=true
What I tried is this code that generate a WMSTileSource, which is set on the map:
val tileSource = WMSTileSource("OI.OrthoimageCoverage", arrayOf("https://www.ign.es/wms-inspire/pnoa-ma?SERVICE=WMS&"), "OI.OrthoimageCoverage","1.1.1", "EPSG:3857", null, 256)
binding.map.setTileSource(tileSource)
This error is due to the bbox, is there any configuration that should be done in the bbox or some way to handle it in a more customized way?
This should give me a map painted like this:
However, when I compile, it just shows me a blank map:
Related
We have a usual source url of something like https://my-source/{x}/{y}/{z}. When the user selects filtering options, we'd like to add these params to the url as something like https://my-source/{x}/{y}/{z}?my-param=true and instantly update the map.
Is this possible to achieve in mapbox?
Turns out this is relatively simple! If a little difficult to find, the code below will update the tile url dynamically:
val source = style.getSourceAs<VectorSource>(CHARGE_POINT_SOURCE_ID)
source?.tiles(listOf(newSourceUrl))
I am currently developing android map using mapbox sdk, and I want to add multiple markers when user click on one button. and I type below in my onStyleLoaded but it's not showing anything
List<Feature> symbolLayerIconFeatureList = new ArrayList<>();
symbolLayerIconFeatureList.add(Feature.fromGeometry(
Point.fromLngLat(31.995560, 34.767070)));
symbolLayerIconFeatureList.add(Feature.fromGeometry(
Point.fromLngLat(31.995979, 34.744110)));
symbolLayerIconFeatureList.add(Feature.fromGeometry(
Point.fromLngLat(31.995010, 34.767380)));
style.addImage("charge-icon-id", BitmapFactory.decodeResource(
MapboxNavigationActivity.this.getResources(), R.drawable.map_marker_dark));
style.addSource(new GeoJsonSource("charge-source-id",
FeatureCollection.fromFeatures(symbolLayerIconFeatureList)));
SymbolLayer destinationSymbolLayer = new SymbolLayer("charge-layer-id", "charge-source-id");
destinationSymbolLayer.withProperties(iconImage("charge-icon-id"),
iconAllowOverlap(true),
iconIgnorePlacement(true)
);
style.addLayer(destinationSymbolLayer);
May I ask what are the problem?
It's a bit tough to say without some more context/information, but I'm guessing that the issue is related to the order in which you're adding the source, layer, and image. Take a look at this example: https://docs.mapbox.com/android/maps/examples/marker-symbol-layer/
You'll want to add the image, source, and layer before the style is loaded. You can then make additional adjustments/add data when the style is loaded using the onStyleLoaded listener.
Disclaimer: I work at Mapbox.
I've been using Mapbox GL Native (specifically react-native-mapbox-gl). I'm generating my own vector tiles on a server, and I'd like to have the user download them onto their device from the mobile app. Then I want Mapbox GL to use the local tiles, specified via a TileJSON file referenced in the Mapbox GL Style file.
I've got it working on iOS (at least in the simulator). My style.json looks like the following:
{
"version":8,
"name":"Bright",
"sources":{
"mapbox":{
"type":"vector",
"url": "asset:///absolute/path/map/tile.json"
}
},
"sprite":"asset:///absolute/path/map/sprites/mysprite",
"glyphs":"asset:///absolute/path/map/glyphs/{fontstack}/{range}.pbf",
"metadata":{...},
"layers":[...]
}
with the tile.json looking like:
{
"tiles":[
"asset:///absolute/path/map/tiles/{z}/{x}/{y}.pbf"
],
"tilejson":"2.0.0",
// plus lots of other stuff
}
On Android this doesn't work. It appears that asset:// only works on files bundled inside the APK, not on the filesystem.
Is there something I can do on the Android platform to let Mapbox GL load my downloaded tiles from off the device?
Have you tried using the file:/// path? This usually loads from your app's file directory, eg.
"file:///absolute/path/map/tiles/{z}/{x}/{y}.pbf"
I researched on this for quite a while and I know this kind of questions already answered. But I couldn't find a right answer showing how to practically deal with math formula in Android app. Without including large amount (5~20MB) of files in the Android project, it seems that there is no way to parse & display math formula script like MATHML. I looked at JEuclid and MathJax that were mentioned a lot for Android but I found them in this category.
So at this point, the only way I can think of is to take each of those formula in a image file and display it on Android. But in practice, that manual process is really slow. I am sure this is not a right way.
So I have to ask this again. How to practically display math formula in your Android app?
You can not set maths formula to TextView in android. You have to use WebView in which you can display maths formulae. See mathjax for more information.
if you want to display for android then here is library you can implement in your project. mathjaxwebview
If you want to parse Tex(Inline mode and display mode) formats and ASCII math format you can use this link .I used the above math view given in this link to display formula.It worked like a charm adding to that download mathjax from official site and get fonts folder and put it in your assets folder. It will definitely work.
https://github.com/Nishant-Pathak/MathView
download math view form above link.
The libraries which are using WebView to wrap latex-rendering-js-library (e.g., this, this and this), are not working well with the RecyclerView and will make the app slow. And they are not even updating the js libraries.
Finally, I found "noties/jlatexmath-android", which is using "opencollab/jlatexmath" native Java library. It is fast and can be easily used with RecyclerView.
Sample usage of JLatexMathView:
implementation "ru.noties:jlatexmath-android:$jlatexmath_version"
// for Cyrillic symbols
implementation "ru.noties:jlatexmath-android-font-cyrillic:$jlatexmath_version"
// for Greek symbols
implementation "ru.noties:jlatexmath-android-font-greek:$jlatexmath_version"
<ru.noties.jlatexmath.JLatexMathView
android:id="#+id/j_latex_math_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dip"
android:background="#color/white"
app:jlmv_alignVertical="center"
app:jlmv_alignHorizontal="center"
app:jlmv_textSize="16sp" />
val latexText = "\$\$f(x)=(x+a)(x+b)\$\$"
binding.jLatexMathView.setLatex(latexText)
You can also use it as an extension of "noties/Markwon", a Markdown library for Android. Details can be found here.
Sample Usage of Markwon:
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-latex:$markwon_version"
implementation "io.noties.markwon:inline-parser:$markwon_version"
<TextView
android:id="#+id/tv_markdown"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
val markwon = Markwon.builder(requireContext())
.usePlugin(MarkwonInlineParserPlugin.create())
.usePlugin(JLatexMathPlugin.create(binding.tvMarkdown.textSize) { builder ->
// ENABLE inlines
builder.inlinesEnabled(true)
})
.build()
val latexText = "Example: \$\$f(x)=(x+a)(x+b)\$\$"
markwon.setMarkdown(binding.tvMarkdown, latexText)
You can implement with MathType.
But your data for display must be in MathType format
https://docs.wiris.com/en/mathtype/mathtype_web/sdk/mobile-apps
I'm making an app on android, using webview to load google map (using this url for my webview: http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html).
but i can't put a marker on that webview, can't somebody tell me how?
http://maps.google.com/maps?saddr=37.423156,-122.084917
The above simply shows the directions screen with missing destination field. If you want the pin to show on a simple map screen do this instead:
http://www.google.com/maps?q=37.423156,-122.084917
Clearly lots of ways to skin a cat - but I am loving the Google Static Maps API.
It generates a standard image (of desired size) and you can add points/lines/polygons all from a URL.
Whilst I haven't checked the terms, it is clearly possible to cache/store the result.
Documentation: http://code.google.com/apis/maps/documentation/staticmaps/
Example: http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false
http://maps.google.com/maps?saddr=NJ
load URL like this pass address where you want to put the pin