I am using the example Google Maps API V3 for ASP.NET on Code Project and it works very well.
I'd like to add a little functionality to it but I'm not sure it is possible. I have done some research but I'm not sure what I the terminology for this is.
We have a lat/lon being reported to our SQL Server every 15 seconds. I'd like to take a reading at every minute and map the route where the vehicle has gone for x number number of readings
I can put pins on the maps with lat/lon without a problem but I'd like to show the route that it went, with lines or something to the like.
Is this possible with Google Maps?
Sure. In the Google Maps API, these are called Polylines.
Here is a link to the documentation:
https://developers.google.com/maps/documentation/javascript/reference#Polyline
And here is one of the developer samples using Polylines:
https://google-developers.appspot.com/maps/documentation/javascript/examples/polyline-complex
Related
I've spent most of the Christmas reading through the Bing Maps information. However, there are so many different options and choices that I'm getting stuck on the plentifulness.
In one of the most obvious URLs I see both non-API and API approaches. That's confusing. There are AJAX, REST and Spacial Services and, to the best of my understanding, they do pretty much the same. That's confusing too... :)
So, here's the question. I'd like to create a web page that given a certain input (e.g. XML or JSON) will provide me with an image. The image is supposed to be a map with plotted pins (that contain my descriptions), controls for zoom/pan and (preferably) even traveling routes (automatically computed or provided by me) between those pins. Also, It'd be great if I could set a semi-transparent polygons covering some areas.
Which API am I supposed to use?!
I sis something like that a few years ago with Google Maps but as far I recall, I only sent in a XML file and the map was hosted more or less at Google's.
If you're building a web site, then you'll have to choose between the AJAX Control and the REST services. Basically, the AJAX Control allows you to embedded a map in your page, add pushpins, draw shapes, display routes...etc.
See http://www.bingmapsportal.com/ISDK/AjaxV7#CreateMap1 for a live demo.
The REST services are more useful for tasks simple like static imagery as well as requests like (reverse)geocoding and routing, that don't involve user interaction.
If you want a full "map control" that allows the user to interact with keyboard/mouse, use the AJAX API. If you're not, REST services could be enough.
EDIT:
AJAX API = AJAX control = AJAX v7
Spatial Data Services is a REST API that allows to compute spatial requests against a large number of data. It shouldn't be used to display a map.
If you're interested in something that allows your users to pan/zoom, create pushpins by clicking on the map...etc., then the AJAX control is the most suitable. It offers all the javascript stuff to display a dynamic map that allows user interaction.
If your XML file is in GeoRSS or GPX format then take a look at the modules for Bing Maps here which show you how to do this in a few lines of code: https://bingmapsv7modules.codeplex.com/
If your XML file is a custom format then take a look at the GeoRSS module to see how to read XML in JavaScript.
If you have more than a thousand items in your XML file I would highly recommend storing your data in the Bing Spatial Data Services which will expose it as a spatial REST service, or uploading it to a database and using a web service to load the data to the map. Loading more than 1,000 pushpins to a JavaScript map could be slow. Using a service you can load only the data that is in view which would make your app much faster.
I am new to asp.net and Google maps. I want to achieve tracking capability on my asp.net page. I want to create a number of markers and then move them along a path.
Can any one help me understand, how do I do it?
I want google maps to work as AJAX
this can be done in many ways, I will dish out a very easy solution,
1.Your webpage should load a map and add markers representing your assets with an id.
2. Your web page should ping your web server every sec to query for change
3. If your server has a change to report it should reply back with the latest latlon for those ids as a json
4.you can then update the positions of those markers.
If you can implement http push(long polling/websockets) then even better as you will get near realtime updates
This assumes that your web server is being updated by your tracking device.
your webservice should always return the latest position it has for the assets.
Updating your markers(assets) on client side is pretty easy as well,
To 'move' your existing marker, you'll wanna make sure its global and then you can just update its position within the function with something like:
marker.setPosition(results[0].geometry.location);
Is there any API which i can use in a WPF application to search Google?
The thing is:
Currently my team is searching for few files in Google and they do this alot,
so I would like to build an application which will search for the files in Google and return the links.
E.g:
I am searching for the product pentium 4 chips.
Then they will search in Google for the documentation(PDF's basically) about pentimum 4 chips.
Following this, they will take the search results which matches the manufacturer website(e.g. intel.com)
and with the found PDF's they will continue their work.
I want to use the Google search API to get the details and give them the exact links or links which nearly match.
My problems:
I am not finding a correct api.
I am not sure how to use it.
It doesn't matter if its C# or WPF or WCF.
Frontend can be anything, you need to focus on logics.
Try this
http://googledotnet.codeplex.com/
Also
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/82da7a25-9f30-4d76-93dc-4acd1c2a938a
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
I'm wanting to use google maps and see a million ways to do it on the web. Some are javascript methods and some are asp.net server components with which I have hit and miss luck. What's the easiest and most reliable way using c# and asp.net?
I have my location data including geocodes in a database. I want to provide users a method to do a lookup for certain locations. From there, my code will provide a table of geocodes to google maps with markers on the map corresponding to the found entries. Users can see each entry and need to be able to tell which is which if multiple rows are returned.
Is there a good way to do this?
The Google Maps API is accessed via JavaScript (any server controls are just abstracting this away from you). In the case you described, you would need to dynamically output the required JavaScript to tell the maps API what to display.
See http://dotnet.sys-con.com/node/171162
There are a few server controls to do it, like this, but you have to learn how to do things in one way (server control) or another (Javascript Google API).
I recommend using the Google API, since it has more samples all over the web, and you can use new features implemented by Google right after they release them and don't have to wait for the server control developer to do it.
I would recommend using direct JavaScript to create the Google Maps. It's fairly straight forward and then you will be able to understand what's going on behind the scenes.
Google has some pretty good tutorials and documentation to get you up and running quick. Once you add one to your site, it will become very easy to setup the rest of the customization that you need.
Take a look at this site for examples.
http://code.google.com/apis/maps/documentation/examples/
As usual I point to ComponentOne who has a nice SilverLight control for this that can use google-maps or Microsofts Live Maps, it uses Silverlight Deep Zoom to handle it nicely:
http://www.componentone.com/SuperProducts/MapsSilverlight/
Live example:
http://demo.componentone.com/Silverlight/Factories/
(I'm not from ComponentOne, just a satisfied customer) ;)
I know you can do it yourself with scripts and other ways, but its just so much more fun to use code allreade written. ;)
Best .NET Wrapper for Google Maps or Yahoo Maps?
BTW: I found a great post here that has an example on how to do a store lookup. Works really well. I recommend!!
http://blog.donnfelker.com/post/HOWTO-Build-a-Store-Locator-in-ASPNET.aspx
Check out this example: Data driven Google Maps in ASP.Net
I used ASP.Net Ajax to create a web-service that is callable from JavaScript.
The web-service talks to the database and fills a very basic object. ASP.Net Ajax, then makes the object available to my client javascript. The rest is easy: In the client, you call the webservice from Javascript, read the data returned and populate Google Maps, using simple Google Maps API calls.
Check out the site at link text
Please, try my GoogleMaps control for ASP.NET