Showing different coloured Pins for different Zipcode - google-maps-api-3

I have multiple Zipcode and I want to display different colored pins for different zipcode. Say am displaying 3 locations New York, CHicago, Boston in my map and I want to display Blue colored pin for New York, Green colored pin for Boston and Red colored pin for Chicago. Can somone provide me the answer how to achieve that using Google Map Javascript v3 API?

Part of the definition of the Marker is the icon. Just assign the appropriate icon to each marker.
var marker = new google.maps.Marker(
{position: new google.maps.LatLng(lat, long),
icon: 'path/to/your/icon.png'}
);

Related

Select points within a country using google maps api

I have several markers plotted in a world map using google maps API.
I would like to click in a country and then delete all the other markers and only see the points within this country border. For example, if I click in Brazil I just wanna see the markers inside Brazil.
I also would like to get a list of lat-lngs of the points inside the country after clicking in the country.
Does anybody knows how can I do that?
Thanks in advance!
Maybe the most efficient way is, if you can, to add to all your markers the attribute of the country code where the marker belong to.
When a user click on the map, pass the given lat/long to Geoname webservice (for example, you can also use Google Geocoding API) to obtain the country code. Then loop over your marker array and keep all the desired markers.
To get lat long from a click and get the country code from Geoname:
google.maps.event.addListener(map, 'click', function( event ){
getCountryCode(event.latLng.lat(),event.latLng.lng());
});
function getCountryCode(latitude, longitude) {
$.getJSON('http://ws.geonames.org/countryCode', {
lat: latitude,
lng: longitude,
type: 'JSON'
}, function(result) {
console.log(result.countryCode);
}
}
If you're not able to append the country code to the markers attributes, you will have to work with polygons of each country and search that a point is in a polygon.
If so, maybe this extension could help you: https://github.com/tparkin/Google-Maps-Point-in-Polygon
And for polygons of each country, use a simple geometry like this one: https://github.com/johan/world.geo.json/tree/master/countries

Display marker over dicom image from CADSR file that are necessary to show

I am trying to read an CADSR file I get an various marker from "Graphics Data Tag" I want to show only those marker over the Dicom file that are necessary so let me know what criteria is required to showing up the necessary marker over dicom image
This is the actual output that shown in below image
but I get such kind of Image opuput which is wrong
In the wrong O/P Image there are multiple markers at specific location I want to combine that marker and show single marker as Star for this.Also one marker is not required that display the out of scope of image that marker I don't want to display so how it can be handle from dicom tags or any things required to do.
You are drawing everything that has a graphic data type. So you are showing the centre of the breast and the nipple.
The cluster of marks is a calcification cluster. A calcification cluster contains multiple calcifications each with their own graphic data type.
Look at the documentation for the R2 Server. You are interested in three objects Malcs, Calcs and Mass. A Malc contains a Mass and a calcifiation cluster which you will need to take account of.

Trying to eliminate duplicate markers in GMaps V3 sidebar

I'm using google maps v3 API to display markers from an XML document, and I'm utilizing marker manager to specify the number of markers to show per zoom level.
Here's the link: http://www.wrh.noaa.gov/mfr/rec/v2/index_sidebar_zoom.php
And here's the problem. It seems that upon loading, the script loads all the markers for each zoom level together, so even though I only have ~200 markers, my marker array, named "batch", contains 507 markers. When I display "batch" on the sidebar, it thus displays some duplicate markers.
So to troubleshoot this, I tried to eliminate duplicates using a jquery script I found. However, when I alert the length of the "batch" array and then alert the length of the new array (supposed to be free of duplicates), it shows 507 as well.
So, any suggestions on how to eliminate the duplicate markers, and sort them alphabetically to display on the sidebar?
Lastly, I seem to have lost my functionality of displaying more markers as I zoom in while I've been working on the sidebar. Any ideas on what happened to that functionality?
Thanks for any help,
S
The MarkerManager is diplaying the first 48 markers 4 times, the first 98 markers 3 times, the first 150 markers twice. Is that what you want?
mgr.addMarkers(createMarker(48), 6);
mgr.addMarkers(createMarker(98), 7);
mgr.addMarkers(createMarker(150), 8);
mgr.addMarkers(createMarker(211), 9);
I think what you want is this:
mgr.addMarkers(createMarker(0,48), 6);
mgr.addMarkers(createMarker(48,98), 7);
mgr.addMarkers(createMarker(98,150), 8);
mgr.addMarkers(createMarker(150,211), 9);
And change your createMarker function to take a start and end number.
Like this

Getting marker data from a google map v3

I have a google map v3 with a number of markers, which have a "category" attribute. I also have a left side menu bar, from which a user can select the desired category. When he/she clicks on the selected category, all the markers are cleared from the map, and only markers with the selected category are loaded.
Now, I need some sort of function which can search through the map and get the loaded markers and their data. The data will then be dynamically loaded in the right side menu bar. You can see the page I am talking about at this LINK
Please, any help will be highly appreciated...
I know this isn't the answer you are hoping for, but there is no good way to query the map and ask for all of the markers. As you load the map and create the markers, you want to keep an array of all of your markers or keep an array by category and track your markers in multiple arrays. Keeping an array for each marker type will make it much easier to turn them on/off; that's what I do. Hope this helps -
One solution:
1) Create an array of markers. Every time you create a marker, add it to the array. Also assign a property to the marker of 'category' or something.
marker.category='foo';
2) When user clicks on the button, look through your markers array and test if each marker matches the category. If it does not, set the map to null.
if (markers[iterator].category!='foo'){
markers[iterator].setMap(null);
} else {markers[iterator].setMap(map);}

Google map api v3 markers exclude a city or certain bound

I am using google maps api v3. I have a database of markers with lat and long address that I display on a map and that works fine.
The map is displaying markers for entire state and now I want to know how can exclude markers in a certain city? Say I am displaying a map of Indiana and want to exclude Indianapolis.
I have a rough idea where I can select the points and some how check if they are between a certain range but could someone elaborate on this with a more specific example or is there a better approach to this?
What you need is something called Reverse Geocoding, which will give you result of street name, city name and country name, given longitude latitude example.
I will do these steps :
Iterate all the marker and "reverse geocoding" the marker lat-long.
Check city result of the "reverse geocoding".
If the City is not inside your accepted cities, remove the marker.

Resources