Adding a distance to a GeoPoint

by Eric Crump » Thu, 28 Jan 2010 08:57:52 GMT

Sponsored Links
 I need to draw a circle on my map.  I have the GeoPoint and I have the
radius of the circle in meters.  How do I add a distance to a GeoPoint
and get a GeoPoint as a result?


Adding a distance to a GeoPoint

by Kevin Duffey » Thu, 28 Jan 2010 09:18:46 GMT

 I am interested in this too. The numbers are fractional, so I am wondering
how you actually figure out the distance say, a 1/2 inch is on the screen
relative to the zoom level. Is there an api call that takes into account the
zoom level and can give a way to draw a specific distance.. such as a foot,
mile, etc?


Sponsored Links

Adding a distance to a GeoPoint

by Eric Crump » Thu, 28 Jan 2010 11:46:54 GMT

 Got it to work with this:

radius = (int)projection.metersToEquatorPixels(item.getRadiusInMeters

Still have some rounding issues to work out though


Other Threads

1. Programmatically expanding / collapsing items of an ExpandableListView

Simply remember the last expanded group and collapse it before you
expand another group. This way you don't need a loop.
Try this:

private int currentHourPosition = -1; // initial value

            public void onGroupExpand(int groupPosition) {
                if(currentHourPosition != -1 && currentHourPosition !=
                currentHourPosition = groupPosition;
//              expandableListView.setSelectedGroup(groupPosition);

On 6 Aug., 23:08, Fabrizio Giudici <>


2. Submit a Picture to server

Hi everyone...
I wouldn't post about this again if I really wasn't frustrated about
it.. I've been going through this for a whole week and still I'm not
able to do an image upload... My code doesn't report any errors.. but
not even the intent is working.. please take a minute to go through
it.. it's kinda simple.. like I want it to be..

This is my addPic.class on which I have a ImageView, EditText, a
Button to browse the device and a button to add the picture...

This is the code for the browse button:

deviceBrowse.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
        Intent i = new Intent(Intent.ACTION_PICK,

which calls :

    protected void onActivityResult(int requestCode, int resultCode,
Intent imageReturnedIntent) {
        super.onActivityResult(requestCode, resultCode,

        switch(requestCode) {
            if(resultCode == RESULT_OK){
                Uri selectedImage = imageReturnedIntent.getData();
                String[] filePathColumn =
                Cursor cursor =
getContentResolver().query(selectedImage, filePathColumn, null, null,
                int columnIndex =
                filePath = cursor.getString(columnIndex);
                selectedDeviceImage =
                                exsistingFileName = filePath;

This last piece of code ..put's the path of the file in the label and
the bitmap on the Imageview so I can have a preview..

So here is my problematic piece of code: the add button

 add.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                        // Go to camera mode
                                        Intent addIntent = new 
Intent(v.getContext(), editPic.class);
                                Bundle w = new Bundle();
                                String activityName = "addPic";
                                w.putString("activity", activityName);
                                w.putParcelable("bitmap", selectedDeviceImage);
                                //a.putString("id", picId);

I'll show you the doFileUpload() in a minute... I just wanted to
mention that the intent is not working God knows why.. it doesn't go
to the class I specified...

 private void doFileUpload(){

        HttpURLConnection conn = null;
        DataOutputStream dos = null;
        DataInputStream inStream = null;
        exsistingFileName = filePath;

        // Is this the place are you doing something wrong.

        String lineEnd = "rn";
        String twoHyphens = "--";
        String boundary =  "*****";

        int bytesRead, bytesAvailable, bufferSize;
        byte[] buffer;
        int maxBufferSize = 1*1024*1024;
        String responseFromServer = "";
        String urlString = "
        Log.e("MediaPlayer","Inside second Method");
        FileInputStream fileInputStream = new FileInputStream(new
File(exsistingFileName) );
         // open a URL connection to the Servlet
         URL url = new URL(urlString);
         // Open a HTTP connection to the URL
         conn = (HttpURLConnection) url.openConnection();
         // Allow Inputs
         // Allow Outputs
         // Don't use a cached copy.
         // Use a post method.
         conn.setRequestProperty("Connection", "Keep-Alive");
         conn.setRequestProperty("Content-Type", "multipart/form-
         dos = new DataOutputStream( conn.getOutputStream() );
         dos.writeBytes(twoHyphens + boundary + lineEnd);
         dos.writeBytes("Content-Disposition: form-data; name=
\"uploadedfile\";filename=\"" + exsistingFileName +"\"" +
         Log.e("MediaPlayer","Headers are written");
         // create a buffer of maximum size
         bytesAvailable = fileInputStream.available();
         bufferSize = Math.min(bytesAvailable, maxBufferSize);
         buffer = new byte[bufferSize];
         // read file and write it into form...
         bytesRead =, 0, bufferSize);
         while (bytesRead > 0)
          dos.write(buffer, 0, bufferSize);
          bytesAvailable = fileInputStream.available();
          bufferSize = Math.min(bytesAvailable, maxBufferSize);
          bytesRead =, 0, bufferSize);
         // send multipart form data necesssary after file data...
         dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
         // close streams
         Log.e("MediaPlayer","File is written");
        catch (MalformedURLException ex)
             Log.e("MediaPlayer", "error: " + ex.getMessage(), ex);
        catch (IOException ioe)
             Log.e("MediaPlayer", "error: " + ioe.getMessage(), ioe);
        //------------------ read the SERVER RESPONSE
        try {
              inStream = new DataInputStream
( conn.getInputStream() );
              String str;
              while (( str = inStream.readLine()) != null)
                   Log.e("MediaPlayer","Server Response"+str);
        catch (IOException ioex){
             Log.e("MediaPlayer", "error: " + ioex.getMessage(),


On the server side.. the php is working since I've tested it with HTML
form.. it's just this piece of code which doesnt work .. I have no
ideia.. can someone please help me? :(


3. Cannot use the sdcard while connected by means of USB - problems testing

4. one problem regarding sdk addon

5. Android wifi power mode - kernel or API?

6. GUI alignment ok for emulator and direct transfer but misaligned when published in Android Market?

7. Why has my app disappeared from the market? Has this happened to anyone before?