Show Leaflet images in C# app - c#

I have a Leaflet website that uses a custom tile set for a game map.
I want to display in my C# client app, tiles from the Leaflet map using basically the same algorithm, as if re-creating leaflet in C#.
I already have the placeholder tiles layed out in a grid and have basic navigation, but running into the problem of knowing the tile values to use for the URL (from leaflet docs):
'http://map.somedomain.com/{layer}/{z}/{x}/{y}.png'
I have the layers names, and I want to know the exact X,Y for each tile from a provided zoom level.
How can I calculate this so that when I send out a download request it doesn't hit file not found?
Hope that makes sense.
Thank you.
PS: I don't have access to windows forms, I am using Unity3D engine, if that makes a difference.

I think you would be best off by going over the sourcecode of L.GridLayer which L.TileLayer is extended from. The _pruneTiles function would be a good starting point:
https://github.com/Leaflet/Leaflet/blob/master/src/layer/tile/GridLayer.js#L204

You Can find a tutorial for embedding Leaflet in a C# app in this book:
Leaflet.js Essentials - Chapter 6

Related

C# CNC CONTROLLER

I am trying to create a C# software that can control the CNC machines, First I am trying to create a 3d Space area in the PictureBox (or Pannel), I have gone through the internet and reached about this and I got one video. He made a 3D place in the form space, and it was a good tutorial but I don't know how to create a coordinate system in that space as you see in the image that I have given below.
Pls, Help me to do this.
enter image description here
enter image description here
If I get the proper solution for this, in the future I can develop this project.
Thank you, guys...
Update:
Actually, I have designed a C# program That controls the CNC machines,
For example, we can take UGS, There is much software out there but I need to create this in C#. The Only thing I am suffering here is the 3D coordinate system. How to create the Axis diagram in 3D.
Example: Planet Cnc's "Cnc USB Controller" I want to create this software in C#.
Thanks...
Build a CNC CAD programmer from skratch it's not a trivial activity.
You should be skilled in:
Math and Geometry in particular (vector/matrix calculus, base transformation, ...)
A language to comunicate with CNC (maybe G Code)
3D file formats
etc.
This is old, and you should have fixed the problem by now... but I hope to help someone in the future.
Have you seen Helix-toolkit? This library provides easy 3D camera and object controls for .Net Framework. I used this library in WPF C# for an application that generated G-Code for a CNC machine... this saved me in the simulation.
You can import 3D models (.3Ds or .obj) from your machine to 3D Panels (HelixViewport3D) and use them in the simulation or create meshes on demand in C#.
The documentation is simple, but on GitHub there are lots of examples.
Helix-toolkit on GitHub

Need to use Tiled Map editor with Unity 4.3.4

I shifted to unity few weeks ago. I am developing a 2D platformer. For creating the maps I am using Tiled map editor from www.mapeditor.org . I have created a basic map. Included the tileSheet png and the .tmx file (saved as XML) in the Assets of the project. I am able to read the XML , that is all the gid's. But I don't know how to access a particular portion(tile) from the tileSheet corresponding to a gid.
I think for this I need to load sprite in the memory and select a tile (by specifying Height and width and coords) from texture memory to display it on screen. As given here :http://gamedevelopment.tutsplus.com/tutorials/parsing-and-rendering-tiled-tmx-format-maps-in-your-own-game-engine--gamedev-3104
but its for flash , how I can achieve same thing in Unity using C#. Notice the copyPixel stuff in the flash code. I thought I could use ReadPixels but it is used for reading from screen only not the texture memory.
Thanks.
If you're working in Windows then the Tiled2Unity Utility sounds like it will fit your needs. It exports Object Layers and was made with Unity 4.3 features in mind.
(Full disclosure: I'm the author of Tiled2Unity)
EDIT: Tiled2Unity is available for Mac users as well now. There is a command-line version for Linux users. (all free)
If you can describe more carefully your problem and what you are trying to do, maybe myself or someone can help you better, for example what exactly do you mean by "load a sprite into memory"? Or "select a tile"? Copying pixel data is SLOWWW, and hopefully you don't mean to be doing this in real time.
Here is my real advice though:
Have you checked out UTiled? It does tiled maps in 2D in Unity so I think it already does what you want and it's free.
There is also UniTMX... free.
There is also 'Tiled Tilemaps'... which is like $2.
I also built a system that can also do what I think you are trying to do (your link is broken, so I can't be sure).
The system I built is called 'Tiled to Unity' (you can search it in youtube to see if it does what you want). It allows you to attach gameObjects to tiles and have tile variants, and can do 3D tiles.
Anyway, trying to roll your own pipeline from Tiled into Unity is a ton of work, and with these tools available, I think it is almost certainly unnecessary... That's just imo.

Tool to convert string to BackgroundImage for Windows Phone 8 Live Tile

Currently I'm trying to create a Live Tile where it pulls data from a JSON link, run some code to filter it and spits out the data on the FRONT side of the tile.
From Windows Phone 8's Flip Tile specification, only the back side of the tile can have text. I'd like to enable it for the front side so the user doesn't have to wait for the tile to flip. From what I understand, this can be achieved by converting my text to an image, and then set it as a BackgroundImage for my tile.
Windows Phone 7 had a tool called Ree7 which enables that, but I'd like to enable it for Windows Phone 8, medium and large tiles.
Additionally, it would be great if my tiles don't flip and remain on its front side.
Having extra images such as app icon on the tile would be an additional plus.
Can someone please point me to the right direction to proceed here? Using a pre-built tool (like a Ree7 for WP8) seems like the best way here.
see if this tool could be useful.
http://blogs.msdn.com/b/shintak/archive/2013/01/01/10418997.aspx
he hasn't provided the source, but you could possibly contact the blogger to get it.
http://www.telerik.com/products/windows-phone/overview/all-controls/livetilehelper.aspx
I believe I found the answer to my question. However, if there are better, free alternatives that do not distort the text too much (such as Lawrence Gripper's old BBC News Mobile app, where text is extremely legible with little distortion), please do share it here.
Thanks!

How can I design a map viewer web application with GIF map images? (AVL TRACKING SYSTEM)

I am a student and my final project in graduate study of Computer engineering is design and development a map viewer web application that must be used for an AVL tracking system.
I am trying with applet in java.
First, map images format are GIF/JPG with big/large amount size(100MB).
Now, I want to find, how I break map images into smaller size and is true if I tiling images in order to showing on viewer, and how?
I program a coordinating application to convert lat/lng to pixels and vice versa,
Now I must to find what to doing with maps and find a method that is recommended to showing images of map in viewer.
If you have any idea to tiling or know about it.. or you recommend another method please help me
thanks
I would suggest you have a look at JAI for Java which has a class that implements tile based images. I have not used it much so i cannot get into specifics but what i know is that if you are looking for tile based images in Java JAI is the way to go.
So Google JAI and take it from there.
i may be completly off-track, but since you got long/lat, why don't you use a google map ? with a simple javascript timer, you could have quiclky a near real-time display.
the only problem would be the license and/or daily limit (this may not be a problem if this is not a live/productive system).
regards,
Guillaume

How can I programmatically access the ArcGIS 3D Analyst Toolbar's "Features to 3D" command?

I need to take a 2D shape file in the ".shp" format that ArcGIS accepts, and add 3D information supplied by a raster DEM. I'm looking for how to do this with the ArcObjects API. I'd like to do it in C#, but examples in any .NET language would be welcome. The only thing I've been able to find are descriptions of how to do this manually in one of the ArcGIS desktop apps. Like this helpful HowTo article, or the wonderful full color illustrations on page 22 of this tutorial. That's great and all, but I need to use this feature in the middle of an automated chain of operations. I don't want to have a manual step in the middle.
OK. I figured it out. I'm jotting down an outline of what I did here in case anyone else runs into the same problem.
The key method is ISurface.InterpolateShape. It will copy an existing 2D IGeometry and add 3D information to it from a surface (raster or TIN). I translated this example VB6 code from VB6 to C#, and modified it to call InterpolateShape for each copied IGeometry in the input shape FeatureClass before inserting it into the output FeatureClass.
I won't post any of the code here because I developed it on my company's dime, but this should be enough to figure it out reasonably quickly. Hopefully this will help some other struggling developer get through the problem more quickly.

Categories