Ideas for rendering 2d autocad drawings in a browser - asp.net-mvc

I'm working on a .net mvc web application. A core piece of functionality is a requirement to take a DWG (AutoCAD) file, and render it on the web application, in such a way that the user can zoom in/out and move about the drawing. I also need to add overlays to the drawing to represent various things.
I'm trying to work out the best way to do this. There are various .net CAD libraries out there but the best you can get browser-based are tools that will convert the file to an image on the server and render it on the page.
My current idea is to convert the dwg to an image, use something like google maptiler to chop up the image at various zoom levels, and then use something like openlayers.org to present this to the user.
Are there other/easier/better solutions?

You could convert the DWG to a GIS format like a geo-referenced image (e.g. geoTIFF), and then use a map server to serve the image to OpenLayers or to Google Maps.
Essentially the map server chops up the tiles for you on-the-fly as they are requested. This means you can support arbitrary zooming and panning.
This is the "purest" way of doing things with OpenLayers - and it's a lot easier than it might sound. MapServer & GeoServer are good free open source map servers, this is vanilla stuff for them. In the past I used to chop up images into Google Maps tiles myself, but I'm not going back now.

You may want to look Autodesk's Freewheel application, which allows you to render 2D and 3D files on the server.
Another possibility would be to convert the relevant parts of the drawing file to your own format, and render them with Javascript. You can use a library like Dojo to facilitate this. This approach is more work, but you will get cross-browser compatibility and more control over the display.

Related

how to draw custom lands for OSM

I would like to know how to draw custom lands for an Openstreetmap project. My final purpose is to reproduce a fantasy map with OSM technology.
It's not clear to me how I can generate lands data (continents, islands and so on).
I know is it possible because the project https://opengeofiction.net/ do basically the same thing.
I am a new OSM user and I am moving the firsts steps with GIS software.
I have built my own tile server on the cloud (Ubuntu 18-04) following different tutorials.
I installed JOSM and QGIS to edit maps, but I feel a bit lost with all that options and features.
I already posted questions in openstreetmap forum but I got no response.
I am sure I need only a little hint to get started.
My expected result is to be able to draw a little "imaginary" island.
On a small scale you can use JOSM without OSM download/upload, and just save your edited data locally as an OSM XML file.
That again can then be fed into the different renderers as source file.
On a large scale you would end up creating a copy of the whole OSM stack, serving your own data, like https://wiki.openstreetmap.org/wiki/OpenGeofiction does

A free sample web app for drawing GeoJSON

I am trying to figure out how much time can it take to develop a sample web app that loads maps in GeoJSON format from the server and draws them in the browser with JavaScript.
I have no experience of working with GeoJSON or drawing geospatial data with JavaScript and my idea is that the starting point to develop the app can be a JavaScript component that draws GeoJSON as demonstrated here, where my GeoJSON looks like this.
If you use a tool like HERE XYZ Studio you upload GeoJSON data to style it, edit data in tabular form, etc. and can get the embed code to publish it in your web app.
There are a few tutorials, in particular the one that shows you step-by-step "Mapping Seismic Activity" from publicly available GeoJSON might be a good start. The other tutorials show you how to do it with Leaflet or Tangram if you wanted to try building your own visualization with a different rendering library.

How to set up an image to be used with openlayers?

I have a big image that I want to display on my website, and allow people to navigate it like a map (zoom and move around).
OpenLayers 3 seems to be a good technology for the client side.
Now the question is: how do I set up the server side so that it can serve the image tiles in a way that works with OpenLayers?
Note that there is no "geographical data" to be displayed, just a plain image.
More details: the server side is a pretty common apache+php host. Ideally, I'd just want to split the image with an automatic tool and upload it, and let openlayers take care of the rest.
Could possibly use a service like http://www.maptiler.com/ ?
It looks like you can add non-georeferenced raster images, and have it create tiles for you. Then the tiles could be hosted on your server and used with OL3 or whatever client-side mapping tool.
If your image is not prohibitevely big you could use the ol.layer.Image layer that allows feeding a static image from a URL to it. This has the benefit that you can use the image as-is, without having to split it into tiles or use some fancy protocol to communicate with the tiles server.
There is an official live example with code included.

Real time vector-based OSM renderer in iOS (using OpenGL ES)

I'm looking into a solution that will allow to use OpenStreetMap data to render a 2D top-view vector-based map in iOS, instead of using pre-rendered tiles from a server. Similar to Apple and Google Maps in iOS6+.
I've done extensive research on this matter, but didn't found too much information.
There are a number of iOS apps that do this, but no information on how they implement it. A couple of these apps are:
ForeverMap 2 by skobbler
Galileo Offline Maps
OffMaps 2
The first 2 apps work similar to Apple and Google Maps. The map is drawn in real time whenever the zoom changes.
The last one appears to be using a slightly different approach. It renders the vector data at specific zoom levels and creates tiles which are then used as normal tiles downloaded from a tile server. So the rendering engine could actually be a tile source for the Route-Me library, but instead of downloading the tiles it renders them on the fly.
The first method is preferred.
[Q] I guess one could switch between methods fairly easy, once the OpenGL ES renderer is in place. I mean you could use the renderer as a source for Route-Me to create tiles, or you could use it as a real-time drawer, similar to a game. Am I right?
The closest solution I found is OpenStreetPad. However, it is using Core Graphics instead of OpenGL ES, so the rendering is not hardware accelerated.
Mapbox stated they are working on vector tiles and they'll probably provide an iOS solution for rendering, however it may use Mapnik so I am not sure how efficient will that be. And there's no ETA on since mid 2013.
[Q] Do you know of any other libraries, papers, guides, examples, or some other useful information on how to approach this? Basically how to handle the OSM data and how to actually use OpenGL ES / GLKit to draw that data on the device. Maybe some of the people who have done it can share a few things?
Old question, but there's a new answer.
WhirlyGlobe-Maply will render tile based vector maps on iOS. http://mousebirdconsulting.blogspot.com/2014/03/vector-maps-introduction.html
The technology that powered skobbler's ForeverMap 2 and their current GPS Nav & Maps app is now available on a pay-per use basis. See their developer platform.
Note: they also have a free tier that can be used to develop/launch small apps.
They render the map using OpenGL and "vector data tiles". This vector data tiles contain information regarding road geometry (so you can have routing), POI data & other map features. (eg. boundary limits).
There is a list of OSM-based applications for iOS. It also includes a few open source projects, for example Navit. Navit seems to render the map using SDL/OpenGL. See the Navit iOS wiki page for more information.

delphi+openstreetmap

is there a vcl or a project (in delphi) that would allow me to download OSM tiles and display them on an app?
I have tried embedding an browser and it worked great but i need a way to display the maps offline.
As I see it, there is 3 ways to do this :
Save all displayed tiles as a single image (could be done easily with a TWebBrowser, or TEmbeddedBrowser component) : you would navigate to the map address (OSM Mapping Server) based on given coordinates (top left corner), and then take a snapshot. You need to recalculate the base coordinates (top left corner) after each snapshot.
You need to understand how tiles are generated, wich is not quite difficult :
basically, the scheme of osm tiles generation is as follow http://osmserver.org/tiles/tile/x/y/z.png
Once you understand how it works, you could calculate tiles url by code and download'em one by one.
For more info on the tiles generation scheme look here :
good thread on manifold forum : http://forum.manifold.net/forum/t71011.13#75206
http://wiki.openstreetmap.org/wiki/Slippy_Map
http://wiki.openstreetmap.org/wiki/Tiles%40home
or if you need to go further : http://wiki.openstreetmap.org/wiki/OSM_Protocol_Version_0.5
download the entire OSM maps (available on the web) and use a VCL component to display them (Tatukgis DK...)
Best Regards,
Mo3ez
I don't know the OpenStreetMap project very well, but there's a chance that the project itself has the software to "view" the maps inside a page.
You can accomplish your goal: show the maps off-line using the same basic construct you have now for the user interface: a embedded browser.
What you change is the url the browser will connect to to something like (http://localhost:3458), making your application her own web-server, for example, with Indy TIdHTTPServer binded to port 3458 (just an example port).
That way, you can serve the content for the embedded browser from inside your application, in the same way Delphi IDE (>= 2005) itself provides content for the main page you see when you start it (in fact, a embedded web browser).
To that browser, you serve the viewer page, all it's dependencies and the OSM file. The only restriction to this idea is the viewer MUST do all the things on the client side (for example, it could be javascript, flash, etc.). No server side scripts, unless you are willing to "mimic" the server side behavior or to integrate your application with the script engine (not too easy).
Other chance is to use THBImage, who offers OpenStreetMap integration with Delphi and a (not working) site demo.
Oops! I tried to provide a few hyperlinks in my message but as a new StackOverflow user I'm limited to just one. You might checkout the "Need solution to display map" message thread (25-Jan-2010) on: embarcadero.public.delphi.thirdpartytools.general
I'm trying to solve a similar problem. I need to display a county-wide or city-wide map using Delphi and then put custom icons on the map. I do not need routing or a very detailed map. In the past I've used a TMS "hotspot" component for the custom icons on top of a TImage. Now I need a way for the client to select their own map for the static background image.
A freeware MFC GUI control class (with source) which implements display of OpenStreeMap tiles:
www.naughter.com/osmctrl.html
The zip there has an executable that shows how it works.
This unit is to calculate URLs for the OpenStreetMap Project's TileServer, and other useful utilities as may be needed. If you want to use OpenStreetMap in your pascal programs, then this is for you.
http://code.google.com/p/openstreetmap-fpk/
I'm also considering using the free Tiger/Line maps. Those look pretty good in a free Linux program (xastir).
TatukGIS looks very good (and expensive). I certainly don't need a full GIS solution so this seems to be way overkill just to display a map. But if I don't find a simpler solution this still might be better than integrating MS MapPoint.
TGlobe seems like what I need but sadly it is no longer available.
look in StelMAP for Delphi with OSM
Component to view a map of the project OpenStreetMap for Delphi 2010 without using browser or scripts.
You can view maps offline. Support for proxy servers for work online. Multi-threaded loading tile map speeds up the process to download and view maps.
The set of procedures and property allows you to add a component to map an unlimited number of layers, shapes and images.
Don't know about OSM files, but if you can open them in a browser, you can always embed a TWebBrowser in your Delphi application and load the files within it.
Not the most elegant, but should work...(requires IE)

Resources