Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a 3d buildings #59

Closed
wants to merge 58 commits into from
Closed

Creating a 3d buildings #59

wants to merge 58 commits into from

Conversation

m7vm7v
Copy link

@m7vm7v m7vm7v commented Jul 21, 2016

Is it possible to create a 3d objects if not can you please help me how to build some.

Bradley Cornford and others added 30 commits June 12, 2015 11:18
Conflicts:
	src/Cornford/Googlmapper/MapperServiceProvider.php
Conflicts:
	src/Cornford/Googlmapper/MapperServiceProvider.php
Use an environment variable to set the Google API Key
Changed facade class name same like file name
…ng a bug where rendering a single item from a number of items would cause an error
Exposed markers for each map
Fixed informationWindow
…d the initial options array when building a map to enable/disable scroll wheel zoom
Update readme for draggable markers!
@bradcornford
Copy link
Owner

I don't believe 3D buildings are show in the JavaScript API for Google Maps.

@m7vm7v
Copy link
Author

m7vm7v commented Jul 22, 2016

is there any king of aproach to create 3d building. I have seen that is possible to be created a polygone on the bulding and a second one with the same points but a bit higher then the original (the roof) and then to connect both of the polygones to create the walls... Is it possible to make such an algorytm to run this idea. Or it would be better if I use other source (not google dev) for this one.
Thanks for your work.

@bradcornford
Copy link
Owner

That would be possible, but i believe it would be fairly complex. You could take a look into the following:

http://johndyer.name/drawing-3d-objects-and-building-on-google-maps/

It looks like you have to create polygons around the building then utilise the drawExcrudedShape method to create walls / roofs. However you would still need to manually create the polgon shapes around buildings manually.

@m7vm7v
Copy link
Author

m7vm7v commented Aug 17, 2016

I think I have manage to create something usefull :

Mapper.php
`/**
* Add a new map 3d building.
*
* @param array $coordinates
* @param array $bottomOptions
* @param array $topOptions
* @param array $wallsOptions
* @param array $height
*
* @return self
*/
public function building(array $coordinates = [], array $bottomOptions = [], array $topOptions = [], array $wallsOptions = [], $height = 0.1) {

    $i = 0;
    foreach($coordinates as $coord){
        $bottom[$i]['latitude'] = $coord['latitude'];
        $bottom[$i]['longitude'] = $coord['longitude'];

        $top[$i]['latitude'] = $coord['latitude'] + $height;
        $top[$i]['longitude'] = $coord['longitude'] + $height;

        $i++;
    }
    $i--;

    //bottom
    $this->polygon($bottom, $bottomOptions);

    //roof
    $this->polygon($top, $topOptions);

    //walls
    for($w = $i; $w >= 0; $w--){
        $z= $w - 1;
        if($w === 0) $z = $i;
        $this->polygon([$bottom[$w], $bottom[$z], $top[$z], $top[$w]], $wallsOptions);
    }

    return $this;
}`

and the example for it :

`Mapper::map(1, 1, ['zoom' => 8, 'center' => true]);

    $coordinates = [['latitude' => 1, 'longitude' => 1], ['latitude' => 3, 'longitude' => 1], ['latitude' => 3, 'longitude' => 3], ['latitude' => 1, 'longitude' => 3], ['latitude' => 0, 'longitude' => 1.2], ['latitude' => 0.5, 'longitude' => 1.5]];
    $bottomOptions = ['fillColor' => 'red', 'strokeColor' => 'red', 'strokeOpacity' => 0.5];
    $topOptions = ['fillColor' => 'blue', 'strokeColor' => 'blue', 'strokeWeight' => 5, 'strokeOpacity' => 1, 'fillOpacity' => 1];
    $wallsOptions = ['fillColor' => 'yellow', 'strokeColor' => 'yellow', 'strokeOpacity' => 0.1];
    $height = 0.5;

    Mapper::building($coordinates, $bottomOptions, $topOptions, $wallsOptions, $height);`

It might need some refactoring and meaby I am missing something but if that is helpful for someone I will be happy.

@bradcornford
Copy link
Owner

bradcornford commented Aug 17, 2016

Looks complicated at a glance! I'll take a proper look later.

@bradcornford
Copy link
Owner

Ive raised an issue for this: #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants