I'm new to development and particularly C#. Been thrown in the deep end here but learning quickly :)
I am developing a simple Mapping Web App in VS2008. I have the map window up and running in my form thanks to a web control supplied by Esri.
I now need to provide an address search facility on the form whereby the user can enter postocde, road name etc into boxes and the map window then zooms to this desired location.
I know this can be achieved using Google Maps addressing etc but I need to use an Address table from our database (ArcSDE). My boss has suggested using SQLDataReader in .net to achieve this? Our address table includes columns for road name, postcode etc and a X and Y for each record (points).
If you have the X Y for each record, you could just query the database for the supplied address (with SqlDataReader or any other kind of database access technology) and use that to zoom to the correct coordinates. Also, what API are you using for your map. I assume it's ESRI (i.e., Flex for ArcGIS). I think you can actually include a control in ESRI's api that provides a geocoding service, which you could use to get the coordinates from you database as well.
Related
I have a desktop app in C# using GMap.NET and it's great, but my app must work without Internet. I thought, I needed kinda PostgreSQLProvider for GMap.NET.
So I downloaded an .osm file for Russian Federation, created a postgresql database with postGIS extention and then executed query, which was generated with osm2po (it's huge: 1,2 Gb)
Now I have a databese, which can be visualized with QGis. I want to visualize this database map in my C# application to handle user mouse button clicks and draw some objects on map.
How can I do that? Maybe I should use another framework? All I need from map is get placemarks in mouse button click handler function and draw objects on map.
You can prefetch the maps you want with the demo version of GMAP.NET. Then grab the database generated by the prefetch and use it in your application. its located in
C:\Users\USERNAME\AppData\Local\GMap.NET\TileDBv5\en\Data.gmdb
the Database is in SQLite but I figure you can convert it to any DBMS you want.
I found, where the problem in. osm2po generate for me vector map, but GMap visualize only raster. The solution is to use another framework, such as SharpMap, that can work with vector maps from database.
Of course, I can write my own PgSQLProvider for GMap, but I have only a month and still many other works.
As part of a project, I have to develop a offline C# application that can calculate the distance and journey time between two points. I'm planning on using data from OpenStreetMap but I'm not too sure what the process would involve. I do not want to use OSM's API but rather develop my own backend, to ensure continuity in case someone else decides to pick up the project to improve it. I have several questions:
Where do I download a full map of the United Kingdom from the website?
How would I overlay the postcodes, addresses, places of interests onto the map?
How would this information be read by the C# application (i.e. when the user enters point A or B, it should be pulled from a central database and automatically calculate the distance and journey time between both)
I want the information to be stored on the client side, without the need for a server - is this possible?
Please ask only one question at a time.
Question 1: OSM offers various ways for downloading data. In your case you should download a country extract.
Question 2: For displaying a map either use raster tiles or vector tiles. But before that you should decide whether you want to render your own tiles (in which case you will need some kind of tile server) or use available tiles from the web (in which case you will need constant access to the web).
Question 3: Ideally your C# application will just query a local PostgreSQL/PostGIS database.
Question 4: Which information? Everything? That would require lots of resources on the client for storing and querying the data.
I am trying to begin writing my first app for office.
What I would like to do is simple. I have a database of IDs for my customers. When I hover over one of these IDs, I'd like the app to query a database and display the customers info on the right hand side of the app.
This should be a pretty simple thing to do using apps for office, but I can find no guidelines or help on their web page.
Can anyone provide some simple sample code for doing this?
Thanks very much.
I can say that I spent some time going through this tutorial trying to get a solution for this question. I have a few suggestions about how you will need to proceed in writing your Office App.
I would not advise having the data populate when you hover over an ID field in Excel/etc. You will be hitting your database too many times. I would have set it up, that the user with select a cell with the ID in it and then in your app panel, there will be a button click or event that will make a call to the SQL Server to return the data.
You will need some sort of a web API that you can use to retrieve the data from your SQL Server. The event will pass in your ID that the user selects and then the web API will return the customer details to be populated in your app panel.
Setting up the App Panel seems pretty straight forward in the tutorials on the MSDN site. You can set it up using HTML and CSS to design the page.
I think the biggest thing that you will have to do is set up the API to access the data.
I think these official Microsoft examples will help you a lot.
Example 1 (Bit complex)
http://msdn.microsoft.com/en-us/library/fp142290(v=office.15).aspx
Example 2 (Looks Easy)
http://msdn.microsoft.com/en-us/library/fp142161(v=office.15).aspx
Example 3 (With using Visual Studio)
http://msdn.microsoft.com/en-us/library/fp179835(v=office.15).aspx
Happy Coding...
Is there a part of the api for access different map layer data such as population heat maps, county boundaries or zipcode lines?
I know this is mostly handled by people like ESRI/ArcServer but I was curious is there was some way to get similar information on the phone platform.
At this point, the only way i see it, is to have a huge data set, parse it, and draw the polygons myself. This sounds extremely time consuming on a phone.
Sadly Google, Bing Maps et al. don't expose access to their datasets in anything other than the pre-defined road, satellite styles etc. As tghamm suggests, your best bet for a performant solution on a mobile device is not to draw dynamic polygons, but pre-render your own raster tilesets for the area/zoom levels at which you want to display the data and display these as a custom tile layer ontop of the map control.
A good toolchain for creating such a tileset is:
1.) Use SQL Server Express (or PostGIS, if you prefer) as backend spatial DB - http://www.microsoft.com/express/sql/ ($0)
2.) Get necessary data in shapefile format - http://www.diva-gis.org/Data ($0)
3.) Load the shapefile data into SQL Server - http://www.sharpgis.net/page/shape2sql.aspx ($0)
4.) Write a query to retrieve the necessary information from SQL Server (or retrieve it directly from shapefile) and render it to tiles using Mapnik - http://www.mapnik.org ($0)
Total cost, $0.
Also, be sure to check out open street map - http://osm.org, which provide access to their entire database that you can download and render yourself - in many areas of the world (although not all) it beats both Google and Microsoft in quality and completeness of its data.
Often this data is delivered through use of a tile server, where the geometries are rendered on a server and then cut into tiles so that the client is only responsible for consuming the raster data. There's plenty of places to get good imagery:
http://www.census.gov/geo/www/tiger/
This is a good starting point for your basic geo-political shapes in the US.
From there, there are third party libraries capable of assisting you with consumption of those SHP files directly, such as http://www.thinkgeo.com/.
Alternatively, some people choose to upload the contents of the shp file into a db structure that supports spatial types. I've used Sql Server 2008, which is complimented by some .Net libraries to facilitate shape handling and manipulation for rendering.
Finally, there are likely a good number of open tile servers out there with useful data layers that you need only understand the tiling pattern to consume, e.g. WMS.
Bing Maps API has been great for figuring out all my GPS information sent from a WP7 phone. But I'm not sure how to deal with Zip Codes. I know it varies per country. I'm curious what is the best way to get a Zip code (or similar) from a latitude/longitude. Bing Maps doesn't always return a City with Area code. Sometimes it will bring back "Populated Area" such as the bay area or San Francisco. The zip node in the XML will be blank.
Are there hacks to get around this? Or am I looking at some other complicated calculation and a second web service call?
I ended up using the google api to get this type of information. I wanted to get the suburb I was in and Bing would not return this. May be worth a look to see if Google will return the zip code.
You can use the Locations API to get the location information for a specified point. If you only want the postal code for the specified location, then you just set the includeEntityTypes parameter to PostCode1, though you can request several as a comma-separated list.
As you are no doubt aware, you can also choose between an XML or JSON response.
I'm not sure if there's an easier way to do this with the API, but you can definitely accomplish this without using another service although it's a bit of extra work. You can add a custom tile layer using shape files such as the ones provided here: http://www.census.gov/geo/www/cob/zt_metadata.html