Change WMS CRS in cesiumJS - cesiumjs

I´m currently working on a project where I need to embed a WMS, which doesn´t support CRS:84 but many EPSG Versions. Here is the link to the WMS, which I need to include (the service is not controlled from our side).
I´ve already changed the crs parameter of the WebMapServiceImageryProvider to EPSG:4326, but that doesn´t adjust the bbox parameter to the correct values.
I hope that someone could help me to change the CRS in my cesium project.
I´m happy for any help.

The Answer to my problem was to change the tilingScheme Parameter of the WebMapServiceImageryProvider to the WebMercatorTilingScheme.
new WebMapServiceImageryProvider({
url: new Resource({
url:
'https://haleconnect.com/ows/services/org.868.3ece34f2-a7fc-4135-a1e6-a339add3142c_wms',
}),
parameters: {
TRANSPARENT: true,
STYLES: 'default',
VERSION: '1.3.0',
SERVICE: 'WMS',
FORMAT: 'image/png',
},
tilingScheme: new WebMercatorTilingScheme(),
layers: 'PS.ProtectedSite',
crs: 'EPSG:3857',
}),

Related

Forge Viewer : Turning "Display Edges" per model instead of Global settings

We are displaying an architectural Revit model and adding a fairly detailled site context.
In the Forge Viewer Settings I can turn On or Off "Display Edges" globally.
However we'd like to have the Edges "On" for the Revit Model but "Off" for the context. Is there a way to achieve this?
I found this post and I tried to load the site model with:
viewer.loadDocumentNode(doc, viewables,{
placementTransform: m.matrix,
keepCurrentModels: true,
globalOffset: {x:0,y:0,z:0},
isAEC: false //!<<< Tried this to prevent Edges
})
But it did not change anything and it still depends on the Global settings.
I found another setting and also tried the following but no luck either:
const models = viewer.impl.modelQueue().getModels()
const contextModel = models.filter(m => m.loader.svfUrn === contextURN);
if (Array.isArray(models) && models.length) {
models[0].hasEdges = false;
}
Any help much appreciated!
Not sure which model format of your road model is, but passing the createWireframe: false option should help turn off the model edges with my research.
viewer.loadDocumentNode(doc, bubble, {createWireframe: false, keepCurrentModels: true})

is there possible for set rotation and scale to raster static image source in open layer 6

I am using open layers 6 lib for map rendering and events.
my application needed same like this example http://viglino.github.io/ol-ext/examples/layer/map.geoimage.html i.e. Example have ol.source.GeoImage..
I have tried
I am displaying raster images on map using this sample code is
const url = imagurl;
const extent = [0, 0, imageData.width, imageData.height];
const projection = new Projection({
code: 'xkcd-image',
units: 'pixels',
extent,
});
const imageLayer = new ImageLayer({
source: new Static({
url,
projection,
imageExtent: extent,
}),
});
and i am using affine transformation lib and returns scaling, rotation and transformation..
its giving the values
scaling : 327.805670381418,327.805670381418
rotation : -0.1310210334156003
transformation : 7179251.8557908312,6022627.228704552
i need to add this code into ol-6 static image source
source: new ol.source.GeoImage(
{ image,
imageCenter: transformation,
imageScale: scaling,
imageRotate: rotation,
//projection: pixelProjectio
})
suggest or help on this.. thanks in advance.. and save my days..

How do i hide a layer from layerlist in ArcGIS 4.x Javascript API though i still want it to show up in the map?

I would like to remove Facilities in the layerlist, but still have it show up in the map.
var manned_facilities_back = new MapImageLayer({
url: "http://dotdevgisiis02:6080/arcgis/rest/services/DOT_MAP_PORTAL/Facilities/MapServer",
sublayers: [
{
id: 1,
popupTemplate: templateFT,
},
{
id: 0,
popupTemplate: templateMF,
},
]
I've attempted to add
listmode: hide
or
display: none
under where i have url, but it didn't work. I figure this should be really simple.
Setting the property Layer.listMode to "hide" should work as expected. In your example, make sure you use the correct casing:
var layer = new MapImageLayer({
url: "http://dotdevgisiis02:6080/arcgis/rest/services/DOT_MAP_PORTAL/Facilities/MapServer",
listMode: "hide"
});
Here's a live demo hiding one of the layers from the loaded WebScene:
https://codepen.io/arnofiva/pen/eb198c9b4050b892759ef433e8664fac

In OL3, vector data layer not visible after map setCenter or zoom

Migrating a map to use OL3. When I call map.getView().setCenter or map.getView().zoom on the map, the map behaves correctly, but my vector data layer is no longer visible. I have to do a MouseWheelZoom interaction on the map and then the data layer shows up. This is similar to the issue found in this unanswered Stackoverflow post (How to reload WMTS Tiles after progromattically changing the map center and zoom?) except my map tiles render properly, it is my vector layer that is not visible.
I am creating the WMS tiles layer and map with this:
div = #get 'element'
layers = [ new (ol.layer.Tile)(
title: 'Imagery'
source: new (ol.source.TileWMS)(
url: WMS_VMAP_MAP_SERVER_URL
name: 'VMAP'
params:
LAYERS: 'basic'
FORMAT: 'image/png'
TRANSPARENT: true)) ]
map = new (ol.Map)(
interactions: ol.interaction.defaults().extend([ new (ol.interaction.Select)(style: selectedIconStyle) ])
controls: ol.control.defaults().extend([ new (ol.control.ScaleLine)(units: 'nautical') ])
layers: layers
target: div
view: new (ol.View)(
projection: 'EPSG:4326'
center: [
0
0
]
zoom: 1
maxResolution: 0.703125))
an individual feature is created using this:
feature = new ol.Feature({
geometry: new ol.geom.Point([lng, lat], 'XY'),
title: 'some title'
latitude: lat
longitude: lng
})
vectorSource.addFeature feature
the vector layer is add using this:
vectorLayer = new (ol.layer.Vector)(
source: vectorSource #new (ol.source.Vector)({})
style: circleIconStyle #my defined icon style
id: 'MYDATA'
)
map.addLayer vectorLayer
and when the following event fires...
map.on('singleclick', (e) ->
map.forEachFeatureAtPixel(e.pixel, ((feature, layer) ->
...
)
)
...as part of the event handler I am doing this:
map.getView().setCenter [
feature.get('longitude')
feature.get('latitude')
]
map.getView().setZoom 3
The map centers and zooms correctly, but my vector layer data does not show up by default. Is there something else I am not doing or calling in order to refresh the data layers after setCenter or zoom on the view? or is it something else I have incorrect in how I am setting this up?
thanx
Fixed. The issue was the coordinates were being treated as strings for the Geometry and not numbers. The fix is to ensure that where coordinates are being set, that they are explicitly treated as a number to remove ambiguity from the equation. So everywhere I set a lat/lon (or latitude/longitude) in the map code, I used Number(lat) and Number(lon) instead.
Props to Eric Lemoine for his answering of another issue located at http://comments.gmane.org/gmane.comp.gis.openlayers.devel.ol3/4773 as that is where I saw his solution to that marker display problem and thought it might address mine as well. And it did.

Geocomplete jQuery plugin: initialize page to browser location

I have been trying to get the 'example/form.html' page to initialize in the browser with the browser's current location. To no avail. With this I was trying to pass in a variable of the browser's current location using jQuery. I have also tried to set the location variable in jquery.geocomplete.js manually, using an array, also to no avail. I was trying this:
var defaults = {
bounds: true,
country: null,
map: false,
details: false,
detailsAttribute: "name",
location: ['-27.470933,153.023502'],
I have also tried location: ['-27.470933','153.023502'].
My understanding is that 'bounds' should be set as a meter radius so I will probably also fill that with 5000 if the initial will load. I have also tried pulling in using:
position.coords.latitude
position.coords.longitude;
Any direction on where I should be looking will be appreciated. Another alternative could be just to use the Google AutoComplete though I have been having the same problem.
I'm not really sure what you are trying to pull off with JQuery Geocomplete.
But to access your HTML5 latitude and longitude position, here's some script:
function init() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(browser_geolocation_success, browser_geolocation_error);
}
}
function browser_geolocation_success(geolocation) {
// now here you access your html5 latitude and longitude
// by requesting -> geolocation.coords.latitude ;and -> geolocation.coords.longitude
}
In the last function above, you can do stuff with your position, like create a marker on a Google Maps thats loaded within your HTML already.