ThinkGeo.com    |     Blog    |     Wiki    |     Support

ShapeFile Over Google Map

Hi Ethan ,
Can i send you my Project solution which is in Visual Studio 2012

Hi Djay,

Please don’t open so many topic with the same question, you can reply me in the old one.

And you can sent us 2012, 2015 or 2017 project, we can open them.

Regards,

Ethan

Hello,Ethan
Here i am attaching my Project SolutionShapeFileOverGoogleMap.zip (2.5 MB)
And also attaching ShapeFile saved on D drive.ShapeFile.zip (799.5 KB)
ShapeFile (2).zip (2.3 MB)
ShapeFile layer is displaying on google layer but not at its desired location
Please have a look.

thanks in advance,
djay

Hi Djay,

Thanks for your data and project.

The default bounding box of your data is “389219.695288,2057987.554821,396320.5484,2050449.939274”, I get it like this:

shapeFileFeatureLayer.Open();
RectangleShape rect = shapeFileFeatureLayer.GetBoundingBox();

That means your data is not under decimal degree(is not 4326) and the unit should be meter, and because it don’t cover the Google map, that means its projection is not 3857(900913) also.

I checked your data and hadn’t found the .prj file, so we don’t know what’s the projection of your data, that’s why it don’t works.

Because shape file don’t contains projection information, so the solution is get the projection information from your data provider and then you can reprojection it to make it works with Google.

Regards,

Ethan

Hi Ethan thank you for your information.
i have tried reprojecting the shape file but i am facing same problem.
Actually, i already had sent you shape file projection file.
Here i am attaching .prj file.PROJ.txt (1.6 KB)
Please have a look

Regards,
djay

Hi Djay,

Thanks for the projection information.

I don’t know where the shapes should be located, but from the map it looks the shapes cover the background layer correct.

For test I just set the default area style but comment your custom style.

Please see my change:

MapPage.aspx.cs (5.0 KB)

Wish that’s helpful.

Regards,

Ethan

Thank you Ethan for ur precious help
and also Spatial References website helped me.

Regards,
djay

Hi Djay,

It is glad to help you.
If you need any more help, please feel free to contact us.

Thanks
Mark

We are having an issue with our shapefile not perfectly overlaying google maps as well. I believe the epsg of our shapefile is 4269, I’ve attached the projection file. And this is our code

Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4269);
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
zipCodeLayer.FeatureSource.Projection = proj4;
ShapeFileFeatureLayer.BuildIndexFile(PathFilename);

cb_2017_us_zcta510_500k.zip (285 Bytes)

Hi Jmarshall,

We can’t reproduce your issue.

Attached is a sample, please try it.

post9068.zip (202.6 KB)

The projection of test data(US.shp) is epsg 4269, it seems it match good between Google maps and shape file.

BTW, please add your Google key in config file for test.

Thanks,

Can you reproduce the issue with these files?

Project Files

Hi Jmarshall,

It still works well by this data.

I think you should want to modify our sample to reproduce that.

Regards,

Ethan

Because we are not using webforms we are using MVC, completely different libraries. Are you not able to assist us with the mvc version or should i just post this directly to the mvc forums? We are not going to troubleshoot in webforms when our project is mvc, that’s ridiculous.

Where can I privately send you our entire solution so you can see? The upload is too large for hear and I don’t want to post it publicly.

Hi Jmarshall,

I don’t think it’s different in MVC and Webforms.

Here is a sample for MVC, it just get the same result. https://ap.thinkgeo.com:5001/sharing/fdCP3gJFV

If you want to sent us your sample, you can put it in your network disk, and sent download link to me in forum message.

But I think you should want to modify the sample I provided to reproduce it if your project is too complex.

Regards,

Ethan

Is there documentation or code examples for how to register and handle a click event for a shape file layer, including how to query the shape file underlying data?

Hi Jmarshall,

You can find our many MVC sample here: https://github.com/ThinkGeo?utf8=✓&q=mvc&type=&language=

The HowDoISample-ForMvc should be what you need, and you can also view other samples there.

Regards,

Ethan