WMS service not adding to the map in Silverlight - arcgis

I have created a MapService on ArcGIS Server 10 and enabled the WMS capability
and wrote a code to add this WMS service on my Silverlight 4 map application but it does not add the service, the map is not visible, but when I add the WMS url in ArcMAP I can view the map
Please comment what am I missing here?
Code goes here
ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer newLayer =
new ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer();
newLayer.Url = "http://server1.com/arcgis/services/merged_soi1/MapServer/WMSServer";
newLayer.ID = "newLayer1";
newLayer.SkipGetCapabilities = true;
MyMap.Layers.Add(newLayer);

Try specifying the map layer. WMS allows for multiple layers so even if you only have one you may need to specify the name. For example, the state of NJ offers a WMS here:
http://njwebmap.state.nj.us/njimagery
Put the URL in ArcCatalog and you will see a dozen or layers or so. But if you try to add it to SL with your code, SL will not know which layer to use. So you have to put something like this:
http://njwebmap.state.nj.us/njimagery?layers=Natural2010
Which gets you the 2010 Orthos.
Good luck.
Ernie

Related

Loading local TileFile layer in pydeck

Am trying to load a local TileFile layer in pydeck(0.5) in jupyter notebook
I am using the following code:
import pydeck as pdk
data ='https://localhost:/home/user/myfolder/tiles/{z}/{x}/{y}.png`
layer = pdk.Layer(
'TileLayer', # `type` positional argument is here
data=data
)
# Set the viewport location
view_state = pdk.ViewState(
longitude=50,
latitude=50,
zoom=0,
min_zoom=0,
max_zoom=5,
pitch=40.5,
bearing=-27.36)
# Combined all of it and render a viewport
r = pdk.Deck(layers=[layer], initial_view_state=view_state)
r.to_html('TileLayer-example.html'
This just creates a blank view window in Jupyter where it should show an image.
If I take launch the TileLayer-example.html independently into a browser I also get a blank window, However browser (Firefox) console output is as follows:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:/home/user/myfolder/tiles/0/0/0.png. (Reason: CORS request did not succeed).
TypeError: NetworkError when attempting to fetch resource. tile-layer.js:18:56
value tile-layer.js:18
value tile-layer.js:136
t tile-2d-header.js:90
u runtime.js:45
_invoke runtime.js:271
e runtime.js:97
Babel 2
r
u
I am not sure if the problem is CORS related (calling a local file) or if my data path is just plain wrong? I have tried may variants on path but all seem to have the same console warning issues.
Any suggestions for simple safe ways around the CoRs problem, or suggestions for accessing local TileFiles in PyDeck would be much appreciated
For other folk currently looking to implement TileLayer in Pydeck. It appears TileLayer is not yet documented or currently supported in pydeck and can only be achieved with a custom layer see this github issue and this suggested workaround with a custom layer
With respect to the CoRs issue of trying to display a local file resource in the browser when called from a URL. if you are looking for a quick fix to do a test/debug then in Firefox: the suggestions here help. For Firefox specifically they suggest the following:
go to about:config
search for privacy.file_unique_origin
set it to false.
Note this is a security risk so reset it to true after debugging.
The only workable solution currently seems to be to put the tilefile in the working directory from which your deck project is launched

Databinding uri source of imagebrush

In my application i am binding several properties to a custom user control, and everything works fine, except the images are not showing. For binding i have used the following codes:
Categories.Add(new Models.Category { Name = "Pizza", Count= 4, ImageUri = new Uri("Images/pizza.png", UriKind.Relative) });
I have also tried with different urikinds but the images are never showing.
what could go wrong? The images are in my solutions Images folder.
Use the ms-appx URI scheme:
ImageUri = new Uri("ms-appx:///Images/pizza.png");
Take care to really write ///.
Also make sure that the Build Action of the image file is set to Content, as pointed out in the other answer. Setting Copy to Output Directory does however not seem to be necessary.
Be sure you set the properties of the image so that it is available during runtime. Sometimes if employing Design Time data in Blend, you will see the images in Design Time, but then nothing during run time. The reason is that the images were never deployed with the rest of the solution. Be sure the Build Action on each image is set to Content and I usually set the Copy to Output Directory to Copy if Newer.

How do I provide a custom data as a DataProvider for ImageTilesLayer on a mapControl in XAML file?

How do I provide a custom data as a DataProvider for ImageTilesLayer on a mapControl in XAML file?
I am new to WPF and DevExpress. I was trying a few examples given in the DevExpress documentation site.
Link: How to Load Image Tiles from Another Source
In the example, How to Load Image Tiles from Another Source given in their site, the DataProvider for a ImageTilesLayer is assigned in the code behind file.
Is it possible to mention the same DataProvider in the XAML instead of the code behind file?
You can assign the ImageTilesLayer.DataProvider property in XAML as follows:
<dxc:MapControl>
<dxc:ImageTilesLayer>
<dxc:ImageTilesLayer.DataProvider>
<local:CustomMapDataProvider/>
</dxc:ImageTilesLayer.DataProvider>
</dxc:ImageTilesLayer>
</dxc:MapControl>
P.S.
For more information about XAML properties syntax, see XAML Overview (WPF)-> Property Element Syntax MSDN article.
For more information about custom types in XAML, see XAML and Custom Classes for WPF.
Coding Horror, I would suggest you first read the tutorials given by DevExpress.
Link to the tutorials is below.
https://documentation.devexpress.com/#WPF/CustomDocument10682
It explains the different layers on map control.
Once you have read that, read on how to load images from different source
https://documentation.devexpress.com/#wpf/CustomDocument11174
In the code, instead of giving a url, change it to a local image folder where you have cached all the map tiles.
public class CustomTileSource : MapTileSourceBase {
const string roadUrlTemplate =
#"http://{subdomain}.tile.openstreetmap.org/{tileLevel}/{tileX}/{tileY}.png";
You can know more about caching at https://documentation.devexpress.com/#WPF/CustomDocument12205

Sharepoint 2010 WebPartZone

Is it possible to control the output of a webpartzone in sharepoint.
We would like not to have tables.
What are you doing to handle this ?
We haven't done that. But we did similar stuff to override behavior of other SP controls.
First of all you need to learn the conception of ASP .NET Control Adapter.
The main idea is that it's possible to override behavior of any control. So, in this case you can override Web Part Zone Render method and put your logic there.
The only issue is that you need to register your control adapter for specific browser and use .browser files for that. To workaround that create your own HttpModule and handle BeginRequestEvent. There you can register your adapter for all browsers, e.g.
var browser = m_Application.Context.Request.Browser;
if (browser == null)return;
if (!browser.Adapters.Contains(webPartZoneTypeName)){
browser.Adapter[webPartZoneTypeName] = strongNameOfYourAdapter;
}
Hope this will help.

Removing Directions markers from the Google Maps API V3

To remove a normal marker from a map, I understand you simply call marker.setMap(null), but when implementing the Google Maps directions services, it automatically adds markers A and B onto the map ( calculating directions from point A to point B ). I do not have control over these markers, so I cannot remove them in the normal way. So how can I remove these markers (I have custom markers on the map instead)?
Set the suppressMarkers option to true when creating your DirectionsRenderer object and then the markers won't show up. You could also change the style or icon of the markers. See the API spec for DirectionsRendererOptions for other properties you can set.
...
directionsDisplay = new google.maps.DirectionsRenderer({suppressMarkers: true});
...
EDIT: It looks like the API changed a little bit since my original answer almost 6 years ago, so the answer from #joni-jones is now the correct way. I tweaked my example above to reflect that.
I had a similar problem. The previous solution did not help me. But I tried this:
var directionsDisplay = new google.maps.DirectionsRenderer({suppressMarkers: true}); And it's work.