delphi+openstreetmap - delphi

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)

Related

How to show relationships in my application?

I'm developing my MS Access database editor (mdb, accdb) which I will give everyone for free. I've done mostly everything that matters except relationships. The problem for me is how to show relationship(s). I would like to do it like in the real MS Access:
The thing is, I don't know how would I connect these child windows with a line that is stretching and resizing when one of the windows move etc...
This maybe not a question that can have a direct answer but I'm stuck here and don't know how to show those relationship(s). I'm using C++ Builder XE2.
So you need a library to draw graphs...
Making an answer, for being able to put links in the list (which comments would not allow)
http://sourceforge.net/projects/extgraph/
How to create graphs in Delphi application
http://www.torry.net/pages.php?s=88

How to implement a user definable interactive map in Delphi 2010?

I'd like to have an interactive floor map (so they're not huge) in my application. The maps will be different for every user, but contain similar elements which only differ by quantity and location. The application will show the map, identify certain elements and link them to information from the database.
To design and store the map, I'd rather not roll my own editor and/or come up with some custom file format. However, it would be nice if the format were open and easily readable. SVG seems to be the perfect candidate for the job. All there needs to be is a convention of how to name the elements to make them identifiable. But how to go from there? I need something that can render the SVG and distinguish between the different layers.
TSVG can do exactly this but depends on FireMonkey which I'd rather avoid - it's not even present in Delphi 2010, so I'd have to use another version and do DLL tricks.
Another option would be to use the Chromium Embedded Framework and create the map using HTML, CSS and JavaScript. That feels very bulky, and would be hard to get right.
Are there any simpler ways to do this that I overlooked, either using SVG or perhaps something completely different?
I'm not sure if a GIS system is appropriate for this. It may very well be overkill.
In the end I decided to go for D3.js using Chromium Embedded, to have a flexible and more portable solution.

GPS Software for PC

I will start on a private project that will require some GPS software on my computer, so far I have been contacting Garmin and Destinator to ask if they have some sort of SDK kit for theire map services. however they could not offer me this in Norway.
I am therefore asking here if anyone here know any kind of map software, capable of GPS and have some decent updates on maps every year, that also can provide me with some ActiveX component which I can embed in my application.
I really only need the most basic functions to setup a destination address and drive.. maybe turn on or off some various switches.
You should be able to get some stuff done with Google Maps.
It's slow, and you'll have to interact with a browser. I'm putting up an open source project to wrap all of it into an easy-to-use component, but until that time, using Google Maps from Delphi is just painful.
Alternatively, you could embed Google Earth into your application. Read here how to do that.
Or generate KML files in Delphi and serve it Google Earth either via a webserver via your local machine. You can have the KML refresh itself, and you can have users click links in the KML that's shown in GE. It's basically a stateless approach like normal webbrowsers. I've done that, and it works ok for simple stuff.
As Francois suggested, MapPoint is quite easy to use from Delphi, but it's not free, and it's slooooooooooow. I remember that adding pins took half a second or so. I'm talking about 5 or 6 years ago, so maybe nowadays things are better. The cool thing about MapPoint is that it renders the map for you in realtime, so it places labels intelligently so that they never clip at the borders of your map.
I've used MapWindow GIS from Delphi too. That was also slow and not very stable, but it's quite easy to use. If you don't know the application, just check it out, it's free.
For all of the tools that are mentioned here, there are ways to import GPS data, and all of them (except for Google Maps) will let you connect a GPS receiver, either directly (GE), or via a plugin (MapPoint, MapWindow).
Last but not least, you could always roll your own mapping solution, which is the route that I decided to take a long time ago.
You have the big names like MS Mappoint, ArcGIS from ESRI...
I remember using Mappoint from Delphi was very easy. Not free though!

Good examples of MapServer / OpenLayers

I want to convince some clients to use MapServer and OpenLayers. Please can anyone suggest attractive websites to show off the possiblities!
The clients will be impressed by:
A density map (otherwise known as a heat map, colour-shaded grid coverage, contour plot...).
The ability for the user to download the underlying data for the density map, restricted to the area being viewed, in some format such as netCDF.
Standard OpenLayers stuff. Zooming, panning, scale bar, overview map...
Different base layers. Could be WMS, Google, Bing...
Searching for a placename, map is panned to display the place.
Exposing the heatmap data for other people to use in mashups as WMS or WCS
MapServer.org is back up but demo.mapserver.org seems to be down right now :( But from memory their examples didn't have the "wow" factor. The OpenLayers examples demonstrate only one or two features per example - I want something to wow the clients by showing all the capabilities in one example.
PS If you have good examples that use some other open source tools, post them by all means. But just JavaScript please: customer says no rich client.
EDIT Come on StackOverflow, someone must have an example that uses a density map?? I'm even offering a bounty now...
Note this answer is no longer relevant. The open source maps have since been replaced with a commercial alternative by a different company
http://maps.seai.ie/wind/ - mapping onshore and offshore wind speeds and farms in Ireland
http://maps.seai.ie/geothermal/ - mapping geothermal temperatures in Ireland, and borehole data
uses WMS services (and TileCache) for all the layers, so can be accessed by other client GIS's (well once I've set up metadata etc..)
has a variety of different base maps to choose from
built using MapFish / ExtJS
has drop down gazetteers for County and Townland (an Irish administrative unit)
all the basic map navigation tools and a simple info tool
right click on a layer to set transparency
uses MapServer opensource back-end, plus SQL Server 2008
The systems (and a third more complex Bioenergy Intranet system) got a mention here: http://www.geoconnexion.com/uploads/renewableenergy_intv9i4.pdf
http://haiticrisismap.org/ openlayes + geoxt
would it be possible to create a template map for the client with a bunch of data on it, census, socio, create some simple fake buffers.
Maybe have a look at the HeatMapAPI for Google Maps (not sure you'll wow the client with that though).
Another density map: http://maps.glassfish.org/server/ (showing the use of GlassFish around the world).
We're using the OpenLayers Heatmap layer, mostly because (for us) it handles large data volumes better than the Google Map version (your mileage may vary)
http://www.patrick-wied.at/static/heatmapjs/demo/maps_heatmap_layer/openlayers.php
By large data volumes, I mean location datasets with 100K+ rows
It also works nicely as an ASPX page with dynamic realtime data retrieval from an SQL Server database. I've used a stored procedure to pre-process the data into the array format, grouped by Latitude & Longitude.
For those that need a translation table to convert their UK Postcodes into Latitude & Longitude, here's a good source:
http://www.doogal.co.uk/UKPostcodes.php
The OneGeology Portal (http://portal.onegeology.org/OnegeologyGlobal/) has been online for about 10 years, currently running OpenLayers 2, with an OpenLayers 3 version in development.
The portal attempts to create a geological map of the world by pulling together disparate OGC services provided by data suppliers (mostly Geological Surveys) from across the globe. The portal provides access to data from WMS, WFS (simple and complex feature), and WCS. The portal uses CSW to help manage which functionality is available to a user, and provides the ability to style WMS layers through the application of custom SLD. Map contexts can be saved, shared and loaded using WMC.
There is a gazetteer to help you zoom to a location of choice, the ability to change projections, and scales, and the ability to create a KML file to allow the service to be used in Google Earth. Transparency can be changed on all layers.
There are currently 353 layers.
When the OneGeology project started, all documentation was geared to the support of services provided by MapServer, and many of the services in the portal are MapServer services. However, because the portal utilises open standards, any software that can provide services to those standards can be included.
This is an example of a classified grid generated in MapServer and displayed by OpenLayers: https://maps.greenwoodmap.com/sublette/mapserver/map#zcr=1/2690000/1170000/0&lyrs=slopesZ,townlim,ownership,roads. The raw, unclassified slope data can also queried by map click.

Printing from web pages (reports especially) with greater precision

I am re-engineering a windows application to be ported to web. One area that has been worrying is 'printing'.
The application is data intensive and complex reports need to be generated. The erstwhile windows application takes advantage of printer APIs and extends sophisticated control to the users. It supports functions like page break, avoiding printing on printed parts of the sheet (like letterhead), choice of layouts and orientation, etc. Please note that these setting are not done only while printing, they are part of report definition sometimes.
From what I know, we cannot have this kind of control while printing web pages. I am in a process of identifying options at my disposal. While I prefer to first look into something that will help me print from raw web pages, following are other thoughts:
Since reports can also be exported to .xls & .pdf versions, let user download one and print directly. This however limits my solution to the area of application that have export feature.
Use Silverlight (4.0) for report layout definition and print. I think Silverlight 4.0 (in beta right now) provides adequate control over the printer. I have so far been avoiding the need of any RIA plugin.
Meticulously generate reports on web with fixed dimensions. I am not sure how far this will go.
Please share practices that can be applied easily in my scenario.
For reporting in the past on the web, using .NET, I like to generate PDF, Excel, Word or CSV files. I really like iTextSharp which allows for creating of PDF's.
Word can accept HTML, so that is usually quote easy. For more control you can get into the Word interops http://nishantrana.wordpress.com/2007/11/03/creating-word-document-using-c/, but they left me frustrated. Not for implementation, but I felt the clean up was poor.
CSV are great for raw data dumps and that is it.
For HTML, you can get nice control using a style sheet targeted to print media. There are just certain things you cannot control, like browser header and footer.
Flash also has better print controls than plain HTML, though you might not know it since these features are rarely used by flash developers. Almost everyone should have Flash installed these days, so it's not like Silverlight where there's a good chance of someone needing to install a plugin (doubly so for a beta version). I am not sure how the Flash printer APIs compare to Silverlight's printer APIs and if they give you the level of control you need, but their documentation is public so you can look into it.
Also I think exporting to PDF is a good idea. I don't see why you can't extend this to cover all places that would need to print a report. Basically instead of printing directly from the windows app running on their desktop, the same exact code runs on your server and generates a PDF that they can then print themselves.
I don't think you're going to have much luck trying to do it with raw HTML unfortunately. For one of our clients, we went with the "generate PDF" route and it worked out quite well. PDFs have the additional advantage that you don't have to print them out: you can just email them to the boss/accountant/whatever saving a bit of paper.
PDF is the way to go, if you want absolute control over printed output. As bonus, you can also provide the option to download PDFs in your application.
With HTML, you are at the mercy of user's browser settings for page size, margin and how page breaks will be handled.

Resources