unknown311


Man do i need help. i started off and got to this point and realised i was going in 2 opposite directions. i have a simple VE Map page using HTML/JS. i also have a PHP page that Queries a MySQL server and returns results. all i am looking for is how i would be able to do the following:
allow a person to cruise(browse) the map in my simple page, and have 4 buttons to the side that would be toggled on/off to show 1 of 4 categories in my MySQL DB. obviously i realised with PHP it's server side and couldn't update on the fly. i am using a linux provider for this, which means no ASP.NET or any other gr8 MS jazz.
the layout: MySQL-DB (name,address,type-of-place, lat, long). i currently dont have lat and long info (i'm guessing thats what everyone means by Geo-friendly). i plan on getting this info by looping through the whole DB (once) and getting this info from the return of the VE API somehow. i know it's possible to return a lat/long of an address, but the key here is the whole connection to the DB WHILE doing Java.

i looked into JSDB, Connector/J but i didn't delve into it much. i learned all the info here from scratch by simple tutorials and trying it myself (not too much in depth and small nicks and such). i'm no expert in any of these languages but i do know how to "code" in general. i use some C++ and VB/VBA.

let me know if anyone could help. and if you need any more info about anything, also let me know. THANK YOU IN ADVANCE for whatever help you can give.




Re: MySQL, VE API, and around 1Million places to display

SoulSolutions


You are going to face a few issues with 1 million pins. Here are a few things to consider:

Don't show more then 300 pins on the map at one time.

When your zoomed out do you want the pins to be all ontop of each other or would clustering them into a single point be better

When zoomed in you can get the current view bounds and only show what is currently visible.

How big is the data for 1 million pins I would suspect you don't want to send it all to the client at on load! I would like at an ondemand style model.

AJAX is your friend.

This is old but hopefully of interest to you:

http://viavirtualearth.com/vve/Articles/Clustering.ashx

John.







Re: MySQL, VE API, and around 1Million places to display

unknown311

well that sort of helps but my main issue is i need small concise examples. all i need is the mechanism in which i can call a SQL query dynamically everytime the user pans/zooms and refresh the map without reloading. i have a PHP/MySQL server. VE uses JS. i dont know how to connect them or pass variables/arrays through to a PHP page each time or something.
if this cannot be done, then tell me to switch my server to an MS one, and i'll make that happen. and if you could, give me websites with actual code that i could use. simple, sample code that merely shows me how to connect the two, or something like that.
thanks






Re: MySQL, VE API, and around 1Million places to display

SoulSolutions

That article used a really simplist model where the server side code produces the javascript that needs to be executed. You call the server page from javascript using AJAX. When the results are returned you use the javascript eval() to execute that javascript.

You do not need to be using .net but clearly most VE examples are going to use it.

John.






Re: MySQL, VE API, and around 1Million places to display

Rajeshkn

Hi,

I am a freelance developer & am doing the VE integration for the first time. Need your expertise in guiding me & helping me acheive this job.

This is for a real estate client of mine who wants to display all his properties on the map BUT thats not working for me, I am able to make the user search the database, arrive at the results & ONLY a particular property gets mapped (pushpin) on the VE. The client requires all properties in & around that area to be shown as pushpins & then the user hovering the mouse, seeing details & then getting to the individual property on VE through the Birds Eye view.

The site is constructed on PHP/MySql & the datafeed comes through an IDX from the MLS.The data does not have latitude or longitude & am using the SDK suggested process to reach the particular property.

Can you please help me with the codes on how to get all the properties listed on VE.

Your help / suggestion is greatly appreciated.

Rajesh




Re: MySQL, VE API, and around 1Million places to display

Derek Chan

I'm going to need a description of how your actually putting the pushpins on the map.

Sounds like for every entry in your database you execute a findlocation, combined with an add pushpin If so, what kind of data is being passed into your findlocation (how are you getting your latlongs).






Re: MySQL, VE API, and around 1Million places to display

Rajeshkn

Many Many thanks for your reply. I am attaching the codes below for your reference.

Issues:

1. Data is received through IDX fvrom a MLS company which has various fields that describe a property BUT it does not contain the longitude or latitude.

2. We are able to add only one pushpin out of a chosen record & not able to show pushpins of all properties available for that locality which is present in the database.

3. The requirement for the client is that, if someone chooses only Losangeles, the map should show all properties that are available on Losangeles area, currently this portion does not work as I donot know how to do this But if a user chooses a particular property in losangeles, it leads to the property on the map.

trust, I have explained myself....do help me out...:-)

Rajesh

HTML file:

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" href="styles.css" rel="stylesheet">
<script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script>

<script>
function GetMap() {
map = new VEMap('VEMap');


map.LoadMap();
map.Find("","10836+tabor+street,los+angeles,CA,90034","1",onFindResults);

}

function onFindResults(findResults)
{


var val="<table ><tr><td align=left><table ><tr><td><img src=\"hai.jpg\"></td></tr></table></td><td align=right><table ><tr><td><b/>Address</td><td>address information</td></tr><tr><td><b/>Price</td><td>price</td></tr><tr><td><b/>Beds</td><td>beds</td></tr><tr><td><b/>Baths</td><td>baths</td></tr></table></td></tr></table>";


var pin = new VEPushpin( 3, new VELatLong(34.025030,-118.407240) , null,val , "First" );
map.AddPushpin(pin);



}


</script>
</head>
<body onLoad="GetMap();"><br><br><br><br>
<br>
<br><br><br>
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>

<td width="50%" align="center">


<div id="VEMap" class="VEMap"></div>
<span id="infoBalloon" class="infoBalloon"></span>



</td></tr>

</table>

</body>
</html>

CSS File:

body
{
/* background: url(images/background.gif) repeat-y; */
margin: 0px;
padding: 0px 0px 15px;
}

body, p, td
{
color: #666;
font-size: 11px;
font-family: Verdana;
}

.bodyTable{padding: 10 10 10 10;}

.body_home
{
color: white;
background-color: #858274;
}
.VEMap {
border: solid #656463 1px;
position: relative;
clear: both;
width:700px;
height:400px;"
}

.infoBalloon { /*filter:alpha(opacity:50);*/ position: absolute; display: none; color:#000; height: 47px; padding:0; }
.mapInstructions {
border:#FF0000 1px dotted;
position: relative;
height:15px;
valign:middle;
}


#propertyCount div { font: bold 11px/16px arial, san-serif; color: #333; float: right; padding: 4px 0 0 0px; height: 19px; }
#propertyCount .left { background: url(images/propCountBG_L.gif) no-repeat; width:10px; }
#propertyCount .center { background: url(images/propCountBG_C.gif) repeat-x; }
#propertyCount .right { background: url(images/propCountBG_R.gif) no-repeat; width:5px; }
#propertyCount .count { color: #c30; font-size: 16px; padding-right: 2px; }
* html #propertyCount div { height: 23px; }





Re: MySQL, VE API, and around 1Million places to display

SoulSolutions

Use VE as the interface layer but build your business logic and data tier server side.

Are you really going to request the data from your provider every time someone wants to look at a map Its not going to be fast.

I recommend storing the data in your data tier, having a background process using map point to geocode the locations once and implimenting some forms of opomisations to reduce the quantity of data on the map. Clearly I am going to reommend clustering and encoding the data and using ajax to communicate async to the client.

There is plenty of resources on this forum and http://ViaVirtualEarth.com to help you out.

John.






Re: MySQL, VE API, and around 1Million places to display

Rajeshkn

Hi John,

Thanks, I figured out & have been making steady progress....I have done the geocoding for all the data that I receive from my data provider & have kept the long/lat as additional fields in the same database. Now multiple pushpin works.

I should be able to reach what my client intended to night our time. Wish me good luck!

Rajesh





Re: MySQL, VE API, and around 1Million places to display

Ashh

Hi john,

I am successfully implemented u r clustering concept in my project. but in this few little bugs. i am o facing below bug.

with cluster concept i am showed only clustered image on the map. actually this image contains 10 actual images but these images are not visible.upto this point every thing fine. when i am double click the map the map go to drill down and shows only few images. they not shows all images with tin this area.

pls give me your suggestion.

whats going on when i am double click the map. and how to restrict the zoom level when i am double click the map.

Thanks & Regards

Pramod






Re: MySQL, VE API, and around 1Million places to display

SoulSolutions

I'm not sure i quite follow you.

The clustering logic does take a zoom level so if you want to not cluster at a given zoomlevel or below you can put a simple if statement in the logic

Or are you saying when the pins de-cluster they end up out of view Do you have a really small map you could use a smaller pin and reduce the cluster area (the const values at the top of the clustering) to suit.

Maybe if you post a link it may explain what is going on

John.






Re: MySQL, VE API, and around 1Million places to display

Ashh

Hi john,

thanks for your response.

I have impelmented "if condition" in getdata web method. Now its working fine still little bit bugs. below code are what i am following in my project.

actually the asset locations are very near to each other.

[WebMethod]

public List<VEPushpin> GetData(VELatLong TopLeftVisible, VELatLong BottomRightVisible, int ZoomLevel, int Width, int Height)

{

List<VEPushpin> rnddata = getrandomdata();

List<PushpinPixel> pixelvisibledata;

List<VEPushpin> groupeddata;

PushPinPixelComparer PPPC = new PushPinPixelComparer();

// get visible points only

pixelvisibledata = getVisibleitems(ref rnddata, TopLeftVisible, BottomRightVisible, ZoomLevel);

// order by pixel x then y

pixelvisibledata.Sort(PPPC);

// set the pixel bounds based on height and width and maximum allowed points

if (pixelvisibledata.Count > 50 && pixelvisibledata.Count < 100)

{

ipixelwidth = Convert.ToInt32((Width / Math.Sqrt(imaxSecondRenderedPoints)));

ipixelheight = Convert.ToInt32((Height / Math.Sqrt(imaxSecondRenderedPoints)));

}

else if (pixelvisibledata.Count < 50)

{

ipixelwidth = Convert.ToInt32((Width / Math.Sqrt(imaxThirdRenderedPoints)));

ipixelheight = Convert.ToInt32((Height / Math.Sqrt(imaxThirdRenderedPoints)));

}

else

{

ipixelwidth = Convert.ToInt32((Width / Math.Sqrt(iMaxRenderedPoints)));

ipixelheight = Convert.ToInt32((Height / Math.Sqrt(iMaxRenderedPoints)));

}

// cluster points

groupeddata = clusterpoints(ref pixelvisibledata);

return groupeddata;

}






Re: MySQL, VE API, and around 1Million places to display

SoulSolutions

Wow that code is old....I am so going to put up a new simply version this weekend. From memory there is a byref to be careful of in there also if you cache the data. Send me an email - john at soulsolutions.com.au - and i'll make sure your one of the first to see the new article.

I put in that whole

else if (pixelvisibledata.Count < 50)

as an idea to make sure not too many pins were rendered - drop that bit out, it doesn't work in practice. What it does is effectly stop more then 50 pins from ever showing, I think this maybe the issue you have

John






Re: MySQL, VE API, and around 1Million places to display

Ashh

Hi john,

your clustering concept implemented successfully in my project. but i have one doubt.in u r clustering concept u only generate point data only in my project generate the point data and polygon data. so how to implement this concept in my project.actaully i am implemented using xml for polygon data. but its very slow. so please give me u r suggestion for this. my mail id is chpramodreddy@gmail.com

Thanks and With Regards

PramodReddy






Re: MySQL, VE API, and around 1Million places to display

Ashh

Hi john,

Good Morning.

How r u i hope you doing well.

you said that new clustring concept. because i am using old concept in my project. i am very interested that new one.

please send me that one. i very thanksful to you.you helped me a lot of times.

my emailid chpramodreddy@yahoo.com